Skip to content

Commit

Permalink
chore(lsp): enable inlay hints on all clients
Browse files Browse the repository at this point in the history
  • Loading branch information
cfcosta committed Sep 25, 2024
1 parent 1061835 commit 21c42a7
Showing 1 changed file with 57 additions and 72 deletions.
129 changes: 57 additions & 72 deletions plugins/lspconfig/configuration.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,61 @@
local lspconfig = require("lspconfig")
local default_options = {
on_attach = function(client, bufnr)
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
end
end,
}

------------------------------------------------------------------
-- Servers Setup
------------------------------------------------------------------
lspconfig.aiken.setup(default_options)
lspconfig.bashls.setup(default_options)
lspconfig.beancount.setup(default_options)
lspconfig.bufls.setup(default_options)
lspconfig.clangd.setup(default_options)
lspconfig.docker_compose_language_service.setup(default_options)
lspconfig.dockerls.setup(default_options)
lspconfig.gopls.setup(default_options)
lspconfig.jqls.setup(default_options)
lspconfig.nixd.setup(default_options)
lspconfig.postgres_lsp.setup(default_options)
lspconfig.ruff.setup(default_options)
lspconfig.ruff_lsp.setup(default_options)
lspconfig.taplo.setup(default_options)

lspconfig.lua_ls.setup({
on_attach = default_options.on_attach,
settings = {
Lua = {
hints = {
enable = true,
setType = true,
arrayIndex = "Enable",
},
runtime = {
version = "LuaJIT",
pathStrict = true,
},
telemetry = {
enable = false,
},
workspace = {
check3rdParty = false,

diagnostics = {
globals = { "vim" },
},

library = {
os.getenv("NIGHTVIM_ROOT") .. "/pack/nightvim/start",
vim.env.VIMRUNTIME,
},
},
},
},
})

------------------------------------------------------------------
-- Diagnostic Symbols
Expand Down Expand Up @@ -43,75 +100,3 @@ vim.api.nvim_set_keymap(
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap("n", "<leader>cr", "<cmd>lua vim.lsp.buf.rename()<CR>", { noremap = true, silent = true })

------------------------------------------------------------------
-- Servers Setup
------------------------------------------------------------------
lspconfig.aiken.setup({})
lspconfig.bashls.setup({})
lspconfig.beancount.setup({})
lspconfig.bufls.setup({})
lspconfig.clangd.setup({})
lspconfig.docker_compose_language_service.setup({})
lspconfig.dockerls.setup({})
lspconfig.gopls.setup({})
lspconfig.jqls.setup({})
lspconfig.nixd.setup({})
lspconfig.postgres_lsp.setup({})
lspconfig.ruff.setup({})
lspconfig.ruff_lsp.setup({})
lspconfig.taplo.setup({})

------------------------------------------------------------------
-- Lua
------------------------------------------------------------------
lspconfig.lua_ls.setup({
settings = {
Lua = {
hints = {
enable = true,
setType = true,
},
runtime = {
version = "LuaJIT",
pathStrict = true,
},
telemetry = {
enable = false,
},
workspace = {
check3rdParty = false,

diagnostics = {
globals = { "vim" },
},

library = {
os.getenv("NIGHTVIM_ROOT") .. "/pack/nightvim/start",
vim.env.VIMRUNTIME,
},
},
},
},
})

------------------------------------------------------------------
-- Go
------------------------------------------------------------------
lspconfig.gopls.setup({
cmd = { "gopls" },
capabilities = require("cmp_nvim_lsp").default_capabilities(),
settings = {
gopls = {
experimentalPostfixCompletions = true,
analyses = {
unusedparams = true,
shadow = true,
},
staticcheck = true,
},
},
init_options = {
usePlaceholders = true,
},
})

0 comments on commit 21c42a7

Please sign in to comment.