[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang

refactor: add comments & update type anotation

+7 -3
lua/gopher/_utils/ts/init.lua
··· 18 18 } 19 19 end 20 20 21 - ---@param row any 22 - ---@param col any 23 - ---@param bufnr any 21 + ---@param row string 22 + ---@param col string 23 + ---@param bufnr string 24 24 ---@return table|nil 25 25 function M.get_struct_node_at_pos(row, col, bufnr) 26 26 local query = M.querys.struct_block .. " " .. M.querys.em_struct_block ··· 33 33 end 34 34 end 35 35 36 + ---@param row string 37 + ---@param col string 38 + ---@param bufnr string 39 + ---@return table|nil 36 40 function M.get_func_method_node_at_pos(row, col, bufnr) 37 41 local query = M.querys.func .. " " .. M.querys.method_name 38 42 local bufn = bufnr or vim.api.nvim_get_current_buf()
+1
lua/gopher/gogenerate.lua
··· 1 1 local Job = require "plenary.job" 2 2 3 + ---run "go generate" 3 4 return function(...) 4 5 local args = { ... } 5 6 if #args == 1 and args[1] == "%" then
+1
lua/gopher/goget.lua
··· 1 1 local Job = require "plenary.job" 2 2 3 + ---run "go get" 3 4 return function(...) 4 5 local args = { ... } 5 6 for i, arg in ipairs(args) do
+1
lua/gopher/gomod.lua
··· 1 1 local Job = require "plenary.job" 2 2 3 + ---run "go mod" 3 4 return function(...) 4 5 local args = { ... } 5 6 local cmd_args = vim.list_extend({ "mod" }, args)
+2
lua/gopher/gotests.lua
··· 45 45 add_test(cmd_args) 46 46 end 47 47 48 + ---generate unit tests for all functions in current file 49 + ---@param parallel boolean 48 50 function M.all_tests(parallel) 49 51 local cmd_args = { "-all" } 50 52 if parallel then
+1 -3
lua/gopher/impl.lua
··· 1 1 local Job = require "plenary.job" 2 2 local ts_utils = require "gopher._utils.ts" 3 3 4 + ---@return string 4 5 local function get_struct() 5 6 local ns = ts_utils.get_struct_node_at_pos(unpack(vim.api.nvim_win_get_cursor(0))) 6 7 if ns == nil then ··· 68 69 local pos = vim.fn.getcurpos()[2] 69 70 table.insert(res_data, 1, "") 70 71 vim.fn.append(pos, res_data) 71 - 72 - -- table.insert(res_data, 1, "") 73 - -- vim.fn.append(vim.fn.getcurpos()[2], res_data) 74 72 end
+1
lua/gopher/installer.lua
··· 5 5 gotests = "github.com/cweill/gotests", 6 6 } 7 7 8 + ---@param pkg string 8 9 local function install(pkg) 9 10 local url = urls[pkg] .. "@latest" 10 11