vim.lsp.Config
Fields5
Config.cmd : string[] | fun(dispatchers: vim.lsp.rpc.Dispatchers, config: vim.lsp.ClientConfig) -> vim.lsp.rpc.Client | nil
See cmd in [vim.lsp.ClientConfig]. See also reuse_client to dynamically decide (per-buffer) when cmd should be re-invoked.
Config.filetypes : string[] | nil
Filetypes the client will attach to, or nil for ALL filetypes. To match files by name, pattern, or contents, you can define a custom filetype using |vim.filetype.add()|:
vim.filetype.add({
filename = {
['my_filename'] = 'my_filetype1',
},
pattern = {
['.*/etc/my_file_pattern/.*'] = 'my_filetype2',
},
})
vim.lsp.config('…', {
filetypes = { 'my_filetype1', 'my_filetype2' },
})
Config.reuse_client : fun(client: vim.lsp.Client, config: vim.lsp.ClientConfig, bufnr: integer) -> boolean | nil
Config.root_dir : string | fun(bufnr: integer, on_dir: fun(root_dir: nil | string) -> nil) -> nil | nil
lsp-root_markers Filename(s) (".git/", "package.json", …) used to decide the workspace root. Unused if root_dir is defined. The list order decides priority. To indicate "equal priority", specify names in a nested list { { 'a.txt', 'b.lua' }, ... }.
- For each item, Nvim will search upwards (from the buffer file) for that marker, or list of
- Example: Find the first ancestor directory containing file or directory "stylua.toml"; if not
markers; search stops at the first directory containing that marker, and the directory is used as the root dir (workspace folder).
found, find the first ancestor containing ".git":
root_markers = { 'stylua.toml', '.git' }
- Example: Find the first ancestor directory containing EITHER "stylua.toml" or ".luarc.json";
if not found, find the first ancestor containing ".git":
root_markers = { { 'stylua.toml', '.luarc.json' }, '.git' }
Config.root_markers : string | string[][] | nil