Some refactoring (#20)
* feat: move all lua api into `api` module * feat: remove boilerplate code, add go work suport * refactor(utils): separete module for health * refactor(dap): remove copy-paste code * fix: comment * chore(lsp): disable type checking * feat: add `go work` command
This commit is contained in:
parent
d65884b182
commit
f835464d7f
13 changed files with 144 additions and 155 deletions
|
|
@ -3,25 +3,25 @@ local ts_utils = require "gopher._utils.ts"
|
|||
local function generate(row, col)
|
||||
local comment, ns = nil, nil
|
||||
|
||||
ns = ts_utils.get_package_node_at_pos(row, col)
|
||||
ns = ts_utils.get_package_node_at_pos(row, col, nil, false)
|
||||
if ns ~= nil then
|
||||
comment = "// Package " .. ns.name .. " provides " .. ns.name
|
||||
return comment, ns
|
||||
end
|
||||
|
||||
ns = ts_utils.get_struct_node_at_pos(row, col)
|
||||
ns = ts_utils.get_struct_node_at_pos(row, col, nil, false)
|
||||
if ns ~= nil then
|
||||
comment = "// " .. ns.name .. " " .. ns.type .. " "
|
||||
return comment, ns
|
||||
end
|
||||
|
||||
ns = ts_utils.get_func_method_node_at_pos(row, col)
|
||||
ns = ts_utils.get_func_method_node_at_pos(row, col, nil, false)
|
||||
if ns ~= nil then
|
||||
comment = "// " .. ns.name .. " " .. ns.type .. " "
|
||||
return comment, ns
|
||||
end
|
||||
|
||||
ns = ts_utils.get_interface_node_at_pos(row, col)
|
||||
ns = ts_utils.get_interface_node_at_pos(row, col, nil, false)
|
||||
if ns ~= nil then
|
||||
comment = "// " .. ns.name .. " " .. ns.type .. " "
|
||||
return comment, ns
|
||||
|
|
@ -39,6 +39,7 @@ return function()
|
|||
ns.dim.s.c,
|
||||
})
|
||||
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
vim.fn.append(row - 1, comment)
|
||||
|
||||
vim.api.nvim_win_set_cursor(0, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue