aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2024-04-24 21:43:46 -0500
committerGitHub <noreply@github.com>2024-04-24 21:43:46 -0500
commit38b9c322c97b63f53caef7a651211fc9312d055e (patch)
treeaf8804460c04d3bd4b2965d7583252506a066cf1 /runtime/lua/vim/lsp.lua
parent16513b30337523dc64707309ee7fe3dd2247266d (diff)
downloadrneovim-38b9c322c97b63f53caef7a651211fc9312d055e.tar.gz
rneovim-38b9c322c97b63f53caef7a651211fc9312d055e.tar.bz2
rneovim-38b9c322c97b63f53caef7a651211fc9312d055e.zip
feat(fs): add vim.fs.root (#28477)
vim.fs.root() is a function for finding a project root relative to a buffer using one or more "root markers". This is useful for LSP and could be useful for other "projects" designs, as well as for any plugins which work with a "projects" concept.
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index ab22c5901a..8403aa0ee6 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -210,7 +210,7 @@ end
--- vim.lsp.start({
--- name = 'my-server-name',
--- cmd = {'name-of-language-server-executable'},
---- root_dir = vim.fs.dirname(vim.fs.find({'pyproject.toml', 'setup.py'}, { upward = true })[1]),
+--- root_dir = vim.fs.root(0, {'pyproject.toml', 'setup.py'}),
--- })
--- ```
---
@@ -219,9 +219,9 @@ end
--- - `name` arbitrary name for the LSP client. Should be unique per language server.
--- - `cmd` command string[] or function, described at |vim.lsp.start_client()|.
--- - `root_dir` path to the project root. By default this is used to decide if an existing client
---- should be re-used. The example above uses |vim.fs.find()| and |vim.fs.dirname()| to detect the
---- root by traversing the file system upwards starting from the current directory until either
---- a `pyproject.toml` or `setup.py` file is found.
+--- should be re-used. The example above uses |vim.fs.root()| and |vim.fs.dirname()| to detect
+--- the root by traversing the file system upwards starting from the current directory until
+--- either a `pyproject.toml` or `setup.py` file is found.
--- - `workspace_folders` list of `{ uri:string, name: string }` tables specifying the project root
--- folders used by the language server. If `nil` the property is derived from `root_dir` for
--- convenience.