From 9bd2a6dcb4d8f6f7231aa86f075447255aea812a Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 27 Apr 2025 06:21:13 +0300 Subject: [PATCH] neovim/lsp: add LSP example; add description to servers option --- modules/neovim/init/lsp.nix | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/modules/neovim/init/lsp.nix b/modules/neovim/init/lsp.nix index 6d3478c9..faef0f93 100644 --- a/modules/neovim/init/lsp.nix +++ b/modules/neovim/init/lsp.nix @@ -30,7 +30,34 @@ in { vim.lsp.servers = mkOption { type = attrsOf lspOptions; default = {}; - description = ""; + example = '' + { + "*" = { + root_markers = [".git"]; + capabilities = { + textDocument = { + semanticTokens = { + multilineTokenSupport = true; + }; + }; + }; + }; + + "clangd" = { + filetypes = ["c"]; + }; + } + ''; + description = '' + LSP configurations that will be managed using `vim.lsp.config()` and + related utilities added in Neovim 0.11. LSPs defined here will be + added to the resulting {file}`init.lua` using `vim.lsp.config` and + enabled through `vim.lsp.enable` below the configuration table. + + You may review the generated configuration by running {command}`nvf-print-config` + in a shell. Please see {command}`:help lsp-config` for more details + on the underlying API. + ''; }; }; @@ -45,7 +72,7 @@ in { (mkIf (cfg.servers != {}) { vim.luaConfigRC.lsp-servers = entryAnywhere '' -- Individual LSP configurations managed by nvf. - ${(concatLines lspConfigurations)} + ${concatLines lspConfigurations} -- Enable configured LSPs explicitly vim.lsp.enable(${toLuaObject (filter (name: name != "*") (attrNames enabledServers))})