refactor of public plugin's api (#37)
* refactor: move all plugin functionality to init.lua * fix(commands): now it uses correct module paths * refactor(config): change way how it handles options * refactor(gotests): use correct config, change way how deps required, fix some typos * fix(healthchecker): use correct config * refactor(iferr): change api * refactor(impl): change api * refactor(installer): change api * refactor(struct_tags): change way of importting deps * refactor(struct_tags): rename M to struct_tags * run stylua * refactor(dap): make it all in one file, and make some refactoring * refactor(_utils): change way how it organizes * fix: use new _utils api * refactor(_utils.health): reorganize module * refactor(_utils.ts): some renameing, moving requires lines * run stylua
This commit is contained in:
parent
94250bb08a
commit
26b41bf68c
18 changed files with 359 additions and 341 deletions
|
|
@ -1,3 +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)
|
||||
|
|
@ -53,10 +57,6 @@ end
|
|||
---@param pos_row string
|
||||
---@return string
|
||||
function M.get_all_nodes(query, lang, _, bufnr, pos_row, _)
|
||||
local ts_query = require "nvim-treesitter.query"
|
||||
local parsers = require "nvim-treesitter.parsers"
|
||||
local locals = require "nvim-treesitter.locals"
|
||||
|
||||
bufnr = bufnr or 0
|
||||
pos_row = pos_row or 30000
|
||||
|
||||
|
|
@ -113,8 +113,6 @@ end
|
|||
---@param col string
|
||||
---@return table
|
||||
function M.nodes_at_cursor(query, default, bufnr, row, col)
|
||||
local u = require "gopher._utils"
|
||||
|
||||
bufnr = bufnr or vim.api.nvim_get_current_buf()
|
||||
local ft = vim.api.nvim_buf_get_option(bufnr, "ft")
|
||||
if row == nil or col == nil then
|
||||
|
|
@ -123,13 +121,19 @@ 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
|
||||
u.notify("Unable to find any nodes. Place your cursor on a go symbol and try again", "debug")
|
||||
u.deferred_notify(
|
||||
"Unable to find any nodes. Place your cursor on a go symbol and try again",
|
||||
vim.log.levels.DEBUG
|
||||
)
|
||||
return nil
|
||||
end
|
||||
|
||||
nodes = M.sort_nodes(M.intersect_nodes(nodes, row, col))
|
||||
if nodes == nil or #nodes == 0 then
|
||||
u.notify("Unable to find any nodes at pos. " .. tostring(row) .. ":" .. tostring(col), "debug")
|
||||
u.deferred_notify(
|
||||
"Unable to find any nodes at pos. " .. tostring(row) .. ":" .. tostring(col),
|
||||
vim.log.levels.DEBUG
|
||||
)
|
||||
return nil
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue