diff options
| author | Michael Adler <adlerm@mailbox.org> | 2022-05-21 05:49:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-20 20:49:10 -0700 |
| commit | 03a047ef52d1bb68a96051c48855799f14a4623b (patch) | |
| tree | d4605d419f06461ed9cbb2a2b2b2ec77f6d069e6 /lua/lspconfig/server_configurations/sumneko_lua.lua | |
| parent | docs: update server_configurations.md (diff) | |
| download | nvim-lspconfig-03a047ef52d1bb68a96051c48855799f14a4623b.tar nvim-lspconfig-03a047ef52d1bb68a96051c48855799f14a4623b.tar.gz nvim-lspconfig-03a047ef52d1bb68a96051c48855799f14a4623b.tar.bz2 nvim-lspconfig-03a047ef52d1bb68a96051c48855799f14a4623b.tar.lz nvim-lspconfig-03a047ef52d1bb68a96051c48855799f14a4623b.tar.xz nvim-lspconfig-03a047ef52d1bb68a96051c48855799f14a4623b.tar.zst nvim-lspconfig-03a047ef52d1bb68a96051c48855799f14a4623b.zip | |
docs(sumneko_lua): fix usage of runtime_path (#1915)
There are two ways for sumneko to search for files, namely:
1. Lua.runtime.path
When using `require`, how to find the file based on the input name.
Setting this config to `?/init.lua` means that when you enter `require
'myfile'`, `${workspace}/myfile/init.lua` will be searched from the
loaded files. if `runtime.pathStrict` is `false`,
`${workspace}/**/myfile/init.lua` will also be searched.
If you want to load files outside the workspace, you need to set
`Lua.workspace.library` first.
2. Lua.workspace.library
In addition to the current workspace, which directories will load files
from. The files in these directories will be treated as externally
provided code libraries, and some features (such as renaming fields)
will not modify these files.
The crucial point is that `Lua.runtime.path` only applies to
the *current* workspace. Thus it makes no sense to add any absolute
directories here. Absolute directories must be added to
workspace.library, which is already the case. The default value provided
by sumneko is what you typically would expect, so we can just stick to it.
References:
- github.com/sumneko/lua-language-server/blob/076dd3e5c4e03f9cef0c57/locale/en-us/setting.lua#L5-L13
- github.com/sumneko/lua-language-server/blob/e62d964ff57cc0b37eb90831/script/config/config.lua#L151
Diffstat (limited to 'lua/lspconfig/server_configurations/sumneko_lua.lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/sumneko_lua.lua | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/lua/lspconfig/server_configurations/sumneko_lua.lua b/lua/lspconfig/server_configurations/sumneko_lua.lua index 5730cb7b..0e06ca15 100644 --- a/lua/lspconfig/server_configurations/sumneko_lua.lua +++ b/lua/lspconfig/server_configurations/sumneko_lua.lua @@ -36,18 +36,12 @@ initial requests (completion, location) upon starting as well as time to first d Completion results will include a workspace indexing progress message until the server has finished indexing. ```lua -local runtime_path = vim.split(package.path, ';') -table.insert(runtime_path, "lua/?.lua") -table.insert(runtime_path, "lua/?/init.lua") - require'lspconfig'.sumneko_lua.setup { settings = { Lua = { runtime = { -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) version = 'LuaJIT', - -- Setup your lua path - path = runtime_path, }, diagnostics = { -- Get the language server to recognize the `vim` global |
