Skip to content

Commit

Permalink
chore(neovim): tweak lsp onsave behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
izumin5210 committed Dec 9, 2024
1 parent 753807e commit f735bfa
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ end
local function code_action_sync(client, bufnr, cmd)
-- https://github.com/golang/tools/blob/gopls/v0.11.0/gopls/doc/vim.md#imports
local params = vim.lsp.util.make_range_params()
params.context = { only = { cmd }, diagnostics = {} }
params.context = { only = { cmd } }
local res = client.request_sync("textDocument/codeAction", params, 3000, bufnr)
for _, r in pairs(res and res.result or {}) do
if r.edit then
Expand Down
6 changes: 0 additions & 6 deletions config/.config/nvim/lua/plugins/lsp/config/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@ local M = {}
---@param args { buf: integer }
function M.run_lsp_actions(actions_by_client_name, args)
local bufnr = args.buf
local shouldSleep = false
for _, client in pairs(vim.lsp.get_clients({ bufnr = bufnr })) do
local actions = actions_by_client_name[client.name]
for _, f in pairs(actions or {}) do
if shouldSleep then
vim.api.nvim_command("sleep 10ms")
else
shouldSleep = true
end
f(client, bufnr)
end
end
Expand Down

0 comments on commit f735bfa

Please sign in to comment.