mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-26 10:48:35 +02:00
plugins/nvim-lsp: add rootDir option for language servers (#387)
This commit is contained in:
parent
fe581914ba
commit
51afeda8e5
2 changed files with 16 additions and 0 deletions
|
@ -67,6 +67,12 @@
|
||||||
`:LspStart` (|lspconfig-commands|).
|
`:LspStart` (|lspconfig-commands|).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
rootDir = helpers.mkNullOrOption types.str ''
|
||||||
|
A function (or function handle) which returns the root of the project used to
|
||||||
|
determine if lspconfig should launch a new language server, or attach a previously
|
||||||
|
launched server when you open a new buffer matching the filetype of the server.
|
||||||
|
'';
|
||||||
|
|
||||||
onAttach =
|
onAttach =
|
||||||
helpers.mkCompositeOption "Server specific on_attach behavior."
|
helpers.mkCompositeOption "Server specific on_attach behavior."
|
||||||
{
|
{
|
||||||
|
@ -123,6 +129,9 @@
|
||||||
extraOptions =
|
extraOptions =
|
||||||
{
|
{
|
||||||
inherit (cfg) cmd filetypes autostart;
|
inherit (cfg) cmd filetypes autostart;
|
||||||
|
root_dir =
|
||||||
|
helpers.ifNonNull' cfg.rootDir
|
||||||
|
(helpers.mkRaw cfg.rootDir);
|
||||||
on_attach =
|
on_attach =
|
||||||
helpers.ifNonNull' cfg.onAttach
|
helpers.ifNonNull' cfg.onAttach
|
||||||
(
|
(
|
||||||
|
|
|
@ -49,6 +49,13 @@
|
||||||
filetypes = ["python"];
|
filetypes = ["python"];
|
||||||
autostart = false;
|
autostart = false;
|
||||||
};
|
};
|
||||||
|
# rootDir
|
||||||
|
typst-lsp = {
|
||||||
|
enable = true;
|
||||||
|
rootDir = ''
|
||||||
|
require 'lspconfig.util'.root_pattern('.git', 'main.typ')
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue