fix(nvim.lsp.gopls): remove unused function
This commit is contained in:
parent
ed6177deee
commit
bae5d77871
1 changed files with 0 additions and 37 deletions
|
@ -15,43 +15,6 @@ function OrgImports(wait_ms)
|
|||
end
|
||||
end
|
||||
|
||||
function goimports(timeout_ms)
|
||||
local context = { only = { "source.organizeImports" } }
|
||||
vim.validate { context = { context, "t", true } }
|
||||
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = context
|
||||
|
||||
-- See the implementation of the textDocument/codeAction callback
|
||||
-- (lua/vim/lsp/handler.lua) for how to do this properly.
|
||||
local results = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, timeout_ms)
|
||||
if not results or next(results) == nil then return end
|
||||
local actions
|
||||
for i, result in pairs(results) do
|
||||
if result then
|
||||
actions = result.result
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not actions then return end
|
||||
local action = actions[1]
|
||||
|
||||
-- textDocument/codeAction can return either Command[] or CodeAction[]. If it
|
||||
-- is a CodeAction, it can have either an edit, a command or both. Edits
|
||||
-- should be executed first.
|
||||
if action.edit or type(action.command) == "table" then
|
||||
if action.edit then
|
||||
vim.lsp.util.apply_workspace_edit(action.edit)
|
||||
end
|
||||
if type(action.command) == "table" then
|
||||
vim.lsp.buf.execute_command(action.command)
|
||||
end
|
||||
else
|
||||
vim.lsp.buf.execute_command(action)
|
||||
end
|
||||
end
|
||||
|
||||
function format_with_imports(timeout_ms)
|
||||
OrgImports(1000)
|
||||
vim.lsp.buf.formatting()
|
||||
|
|
Loading…
Add table
Reference in a new issue