2 files changed,
6 insertions(+),
4 deletions(-)
Author:
Smirnov Oleksandr
ss2316544@gmail.com
Committed at:
2022-06-25 12:00:58 +0300
Parent:
096bc8e
M
lua/gopher/_utils/ts/init.lua
@@ -1,4 +1,5 @@
local nodes = require "gopher._utils.ts.nodes" +local u = require "gopher._utils" local M = { querys = { struct_block = [[((type_declaration (type_spec name:(type_identifier) @struct.name type: (struct_type)))@struct.declaration)]],@@ -27,7 +28,7 @@ local query = M.querys.struct_block .. " " .. M.querys.em_struct_block
local bufn = bufnr or vim.api.nvim_get_current_buf() local ns = nodes.nodes_at_cursor(query, get_name_defaults(), bufn, row, col) if ns == nil then - print "struct not found" + u.notify("struct not found", "warn") else return ns[#ns] end@@ -42,7 +43,7 @@ local query = M.querys.func .. " " .. M.querys.method_name
local bufn = bufnr or vim.api.nvim_get_current_buf() local ns = nodes.nodes_at_cursor(query, get_name_defaults(), bufn, row, col) if ns == nil then - print "func not found" + u.notify("function not found", "warn") else return ns[#ns] end
M
lua/gopher/_utils/ts/nodes.lua
@@ -1,6 +1,7 @@
local ts_query = require "nvim-treesitter.query" local parsers = require "nvim-treesitter.parsers" local locals = require "nvim-treesitter.locals" +local u = require "gopher._utils" local M = {} local function intersects(row, col, sRow, sCol, eRow, eCol)@@ -120,13 +121,13 @@ end
local nodes = M.get_all_nodes(query, ft, default, bufnr, row, col) if nodes == nil then - print "Unable to find any nodes. place your cursor on a go symbol and try again" + u.notify("Unable to find any nodes. Place your cursor on a go symbol and try again", "debug") return nil end nodes = M.sort_nodes(M.intersect_nodes(nodes, row, col)) if nodes == nil or #nodes == 0 then - print("Unable to find any nodes at pos. " .. tostring(row) .. ":" .. tostring(col)) + u.notify("Unable to find any nodes at pos. " .. tostring(row) .. ":" .. tostring(col), "debug") return nil end