Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
glepnir committed Mar 7, 2024
1 parent fb83683 commit f5cf6e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
6 changes: 2 additions & 4 deletions lua/modules/lsp/backend.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ lspconfig.gopls.setup({
cmd = { 'gopls', 'serve' },
on_attach = M._attach,
capabilities = M.capabilities,
init_options = {
usePlaceholders = true,
completeUnimported = true,
},
settings = {
gopls = {
usePlaceholders = true,
completeUnimported = true,
analyses = {
unusedparams = true,
},
Expand Down
23 changes: 0 additions & 23 deletions lua/modules/lsp/package.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,6 @@ packadd({
vim.diagnostic.config({ signs = { text = { i, i, i, i } } })
require('modules.lsp.backend')
require('modules.lsp.frontend')

-- auto kill server when no buffer attach after a while
local debounce
vim.api.nvim_create_autocmd('LspDetach', {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if not client or #client.attached_buffers > 0 then
return
end

if debounce and debounce:is_active() then
debounce:stop()
debounce:close()
debounce = nil
end

debounce:start(5000, 0, function()
vim.schedule(function()
pcall(vim.lsp.stop_client, args.data.client_id, true)
end)
end)
end,
})
end,
})

Expand Down

0 comments on commit f5cf6e5

Please sign in to comment.