|
106 | 106 | `:LspStart` (|lspconfig-commands|).
|
107 | 107 | '';
|
108 | 108 |
|
109 |
| - rootDir = lib.nixvim.defaultNullOpts.mkLuaFn "nil" '' |
110 |
| - A function (or function handle) which returns the root of the project used to |
111 |
| - determine if lspconfig should launch a new language server, or attach a previously |
112 |
| - launched server when you open a new buffer matching the filetype of the server. |
| 109 | + rootMarkers = lib.nixvim.defaultNullOpts.mkListOf types.str null '' |
| 110 | + A list of files that mark the root of the project/workspace. |
| 111 | +
|
| 112 | + Vim's LSP will try to share the same language server instance for all |
| 113 | + buffers matching `filetypes` within the same project. |
| 114 | +
|
| 115 | + A new server instance is only spawned when opening a buffer with a |
| 116 | + different project root. |
| 117 | +
|
| 118 | + See `:h lsp-config` and `:h vim.fs.root()`. |
113 | 119 | '';
|
114 | 120 |
|
115 | 121 | onAttach = lib.nixvim.mkCompositeOption "Server specific on_attach behavior." {
|
|
149 | 155 | name = serverName;
|
150 | 156 | extraOptions = {
|
151 | 157 | inherit (cfg) cmd filetypes autostart;
|
152 |
| - root_dir = cfg.rootDir; |
| 158 | + root_markers = cfg.rootMarkers; |
153 | 159 | on_attach = lib.nixvim.ifNonNull' cfg.onAttach (
|
154 | 160 | lib.nixvim.mkRaw ''
|
155 | 161 | function(client, bufnr)
|
|
183 | 189 | (lib.mkRemovedOptionModule (
|
184 | 190 | basePluginPath ++ [ "extraSettings" ]
|
185 | 191 | ) "You can use `${basePluginPathString}.extraOptions.settings` instead.")
|
| 192 | + (lib.mkRemovedOptionModule (basePluginPath ++ [ "rootDir" ]) '' |
| 193 | +
|
| 194 | + nvim-lspconfig has switched from its own `root_dir` implementation to using neovim's built-in LSP API. |
| 195 | +
|
| 196 | + In most cases you can use `${opts.rootMarkers}` instead. It should be a list of files that mark the root of the project. |
| 197 | + In more complex cases you can still use `${opts.extraOptions}.root_dir`. |
| 198 | + '') |
186 | 199 | ]
|
187 | 200 | ++ lib.optional (args ? extraConfig) (
|
188 | 201 | lib.nixvim.plugins.utils.applyExtraConfig {
|
|
0 commit comments