diff --git a/lua/gopher/_utils/ts/init.lua b/lua/gopher/_utils/ts/init.lua index 8de819e..3c253cc 100644 --- a/lua/gopher/_utils/ts/init.lua +++ b/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 @@ function M.get_struct_node_at_pos(row, col, bufnr) 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 @@ function M.get_func_method_node_at_pos(row, col, bufnr) 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 diff --git a/lua/gopher/_utils/ts/nodes.lua b/lua/gopher/_utils/ts/nodes.lua index d3b6f9a..9b5b813 100644 --- a/lua/gopher/_utils/ts/nodes.lua +++ b/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 @@ function M.nodes_at_cursor(query, default, bufnr, row, col) 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