You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Starting with 2.5.0, I noticed that the language server no longer loaded files that correspond to require()-ed modules.
My neovim scripts generate the language server config at startup, which includes populating Lua.runtime.path and Lua.workspace.library with some custom locations, which includes the current working directory and/or workspace directory (repository root). It adds the following paths to Lua.runtime.path:
/absolute/path/to/workspace/?.lua
/absolute/path/to/workspace/?/init.lua
./?.lua
./?/init.lua
I have discovered that having ?.lua and ?/init.lua (the defaults in the vscode plugin) makes things work properly, but It's odd that the other versions (absolute and relative paths) do not. Is this intended?
With Lua.runtime.path set to ["?.lua", "?/init.lua"], files are correctly located and loaded:
Using relative path (./?.lua|./?/init.lua) or absolute path (/path/to/git/scratch/?.lua|/path/to/git/scratch/?/init.lua) leads to the module not being resolved/loaded:
I've also noted that files outside the workspace cannot be loaded via Lua.runtime.path. For instance, if a file exists at /path/to/other/mod.lua, and I add /path/to/other/?.lua to Lua.runtime.path, it is not discovered. I understand that adding /path/to/other to Lua.workspace.library solves this, but all of this makes me wonder: what is the purpose of Lua.runtime.path if only the default values (?.lua|?/init.lua) actually do anything?
Expected behavior
I expected ?.lua, ./?.lua, and /absolute/path/to/?.lua to be equal/equivalent in behavior, but as of 2.5.0 it seems that only ?.lua has any effect.
Ideally I would like to add certain paths to Lua.runtime.path so that files will be discovered when require()-ed but without adding them to Lua.workspace.library (since that causes the full directory to be scanned and pre-loaded, which leads to a slower startup time).
Environment (please complete the following information):
OS: Linux
Is WSL remote?
Client: VSCode and Neovim
The text was updated successfully, but these errors were encountered:
Describe the bug
Starting with
2.5.0
, I noticed that the language server no longer loaded files that correspond torequire()
-ed modules.My neovim scripts generate the language server config at startup, which includes populating
Lua.runtime.path
andLua.workspace.library
with some custom locations, which includes the current working directory and/or workspace directory (repository root). It adds the following paths toLua.runtime.path
:/absolute/path/to/workspace/?.lua
/absolute/path/to/workspace/?/init.lua
./?.lua
./?/init.lua
I have discovered that having
?.lua
and?/init.lua
(the defaults in the vscode plugin) makes things work properly, but It's odd that the other versions (absolute and relative paths) do not. Is this intended?To Reproduce
Note:
Lua.runtime.pathStrict
is set tofalse
contents of
subdir/sub_module.lua
:contents of
test.lua
:With
Lua.runtime.path
set to["?.lua", "?/init.lua"]
, files are correctly located and loaded:Using relative path (
./?.lua
|./?/init.lua
) or absolute path (/path/to/git/scratch/?.lua
|/path/to/git/scratch/?/init.lua
) leads to the module not being resolved/loaded:I've also noted that files outside the workspace cannot be loaded via
Lua.runtime.path
. For instance, if a file exists at/path/to/other/mod.lua
, and I add/path/to/other/?.lua
toLua.runtime.path
, it is not discovered. I understand that adding/path/to/other
toLua.workspace.library
solves this, but all of this makes me wonder: what is the purpose ofLua.runtime.path
if only the default values (?.lua
|?/init.lua
) actually do anything?Expected behavior
I expected
?.lua
,./?.lua
, and/absolute/path/to/?.lua
to be equal/equivalent in behavior, but as of2.5.0
it seems that only?.lua
has any effect.Ideally I would like to add certain paths to
Lua.runtime.path
so that files will be discovered whenrequire()
-ed but without adding them toLua.workspace.library
(since that causes the full directory to be scanned and pre-loaded, which leads to a slower startup time).Environment (please complete the following information):
Is WSL remote?The text was updated successfully, but these errors were encountered: