default goimport -> gopls

This commit is contained in:
ray-x 2023-11-01 10:42:13 +11:00
parent b31cabdfcf
commit df84343271
2 changed files with 3 additions and 3 deletions

View File

@ -155,7 +155,7 @@ M.gofmt = function(...)
end
M.org_imports = function()
local r = require('go.lsp').codeaction('', 'source.organizeImports', function()
require('go.lsp').codeaction('', 'source.organizeImports', function()
vim.lsp.buf.format({
async = _GO_NVIM_CFG.lsp_fmt_async,
bufnr = vim.api.nvim_get_current_buf(),
@ -172,7 +172,7 @@ M.org_imports = function()
end
M.goimport = function(...)
local goimport = _GO_NVIM_CFG.goimport or 'goimports'
local goimport = _GO_NVIM_CFG.goimport or 'gopls'
local args = { ... }
log(args, goimport)
if goimport == 'gopls' then

View File

@ -10,7 +10,6 @@ describe('should run gopls releated functions', function()
local cmd = " silent exe 'e temp.go'"
vim.cmd(cmd)
require('go').setup({ goimport = 'gopls', lsp_cfg = true })
_GO_NVIM_CFG.log_path = '' -- enable log to console
it('should run import from file with gopls', function()
local path = './fmt/goimports2.go' -- %:p:h ? %:p
local expected =
@ -42,6 +41,7 @@ describe('should run gopls releated functions', function()
end)
it('should run import from file with gopls', function()
vim.cmd('%bdelete!')
_GO_NVIM_CFG.log_path = '' -- enable log to console
local expected =
vim.fn.join(vim.fn.readfile(cur_dir .. '/lua/tests/fixtures/fmt/goimports3_golden.go'), '\n')