Skip to content

plugins/lsp: use vim.lsp native API #3204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions plugins/lsp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ lib.nixvim.plugins.mkNeovimPlugin {
++ mkMaps "vim.lsp.buf." "Lsp buf" cfg.keymaps.lspBuf
++ cfg.keymaps.extra;

# Since https://github.com/nix-community/nixvim/pull/3204, we are now using the native vim.lsp
# API for configuring language servers with nvim-lspconfig.
# For some mysterious reason, `performance.combinePlugins` now prevent language servers from
# being properly configured (missing some keys: `cmd`, `filetypes`, `root_markers` etc.)
performance.combinePlugins.standalonePlugins = [ cfg.package ];

plugins.lsp.onAttach = lib.mkIf cfg.inlayHints ''
-- LSP Inlay Hints {{{
if client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
Expand Down Expand Up @@ -242,15 +248,14 @@ lib.nixvim.plugins.mkNeovimPlugin {
}"}

for i, server in ipairs(__lspServers) do
local options = ${runWrappers cfg.setupWrappers "server.extraOptions"}

if options == nil then
options = __setup
else
options = vim.tbl_extend("keep", options, __setup)
end
vim.lsp.enable(server.name)

require("lspconfig")[server.name].setup(options)
vim.lsp.config(server.name, __setup)

if server.extraOptions then
vim.lsp.config(server.name, server.extraOptions)
end
end

${cfg.postConfig}
Expand Down