diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-03-13 11:54:55 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-13 11:54:55 -0400 |
| commit | 21b540fc804f6595d2fc2f68fb8516dca1fafa0b (patch) | |
| tree | 1960a49742294cd98119bbbc9e73d70c7562c7c5 /doc | |
| parent | docs: update configs.md (diff) | |
| parent | docs: apply auto-generated annotations to LSP configs (diff) | |
| download | nvim-lspconfig-21b540fc804f6595d2fc2f68fb8516dca1fafa0b.tar nvim-lspconfig-21b540fc804f6595d2fc2f68fb8516dca1fafa0b.tar.gz nvim-lspconfig-21b540fc804f6595d2fc2f68fb8516dca1fafa0b.tar.bz2 nvim-lspconfig-21b540fc804f6595d2fc2f68fb8516dca1fafa0b.tar.lz nvim-lspconfig-21b540fc804f6595d2fc2f68fb8516dca1fafa0b.tar.xz nvim-lspconfig-21b540fc804f6595d2fc2f68fb8516dca1fafa0b.tar.zst nvim-lspconfig-21b540fc804f6595d2fc2f68fb8516dca1fafa0b.zip | |
Merge #4306 generate annotations for Lua types
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lspconfig.txt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/doc/lspconfig.txt b/doc/lspconfig.txt index 04dcde73..042acc63 100644 --- a/doc/lspconfig.txt +++ b/doc/lspconfig.txt @@ -48,6 +48,9 @@ example to activate the "clangd" config: >lua -- Enable filetype-based activation of the config. vim.lsp.enable('clangd') < + +lspconfig provides type annotations for LSP settings, see |lspconfig-settings-types|. + *lspconfig-resolved* You can call the "index" form of vim.lsp.config to get the resolved config without activating it: >lua @@ -140,6 +143,34 @@ To create a new config, see |lsp-config| (requires Nvim 0.11+). To contribute a config to nvim-lspconfig, see ../CONTRIBUTING.md. ============================================================================== +SETTINGS TYPES lspconfig-settings-types + +`nvim-lspconfig` generates Lua type definitions for each supported LSP server. +By manually adding annotations (e.g., `---@type lspconfig.settings.server_name`), +you enable auto-completion and diagnostics for your server settings. + +Example: >lua + ---@type vim.lsp.Config + local config = { + ---@type lspconfig.settings.lua_ls + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + workspace = { + library = { + vim.env.VIMRUNTIME, + } + }, + }, + }, + } + + vim.lsp.config('lua_ls', config) +< + +============================================================================== COMPLETION SUPPORT *lspconfig-completion* See |lsp-completion|. |
