Skip to content

Commit f58efab

Browse files
committed
runtime.pathStrict
1 parent 30228e8 commit f58efab

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

package/configuration.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ local config = {
2727
"?/init.lua",
2828
}
2929
},
30+
["Lua.runtime.pathStrict"] = {
31+
scope = 'window',
32+
type = "boolean",
33+
markdownDescription = "%config.runtime.pathStrict%",
34+
default = false,
35+
},
3036
["Lua.runtime.special"] = {
3137
scope = 'window',
3238
type = 'object',

package/nls-zh-cn.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ return {
55
["config.runtime.version"] = "Lua运行版本。",
66
["config.runtime.path"] = [[
77
当使用 `require` 时,如何根据输入的名字来查找文件。
8-
此选项设置为 `?/init.lua` 意味着当你输入 `require 'myfile'` 时,会从已加载的文件中搜索所有的 `**/myfile/init.lua`。
8+
此选项设置为 `?/init.lua` 意味着当你输入 `require 'myfile'` 时,会从已加载的文件中搜索 `{workspace}/myfile/init.lua`。
9+
当 `runtime.pathStrict` 设置为 `false` 时,还会尝试搜索 `${workspace}/**/myfile/init.lua`。
910
如果你想要加载工作区以外的文件,你需要先设置 `Lua.workspace.library`。
1011
]],
12+
["config.runtime.pathStrict"] = '启用后 `runtime.path` 将只搜索第一层目录,见 `runtime.path` 的说明。',
1113
["config.runtime.special"] = [[将自定义全局变量视为一些特殊的内置变量,语言服务将提供特殊的支持。
1214
下面这个例子表示将 `include` 视为 `require` 。
1315
]] .. example.special,

package/nls.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ return {
55
["config.runtime.version"] = "Lua runtime version.",
66
["config.runtime.path"] = [[
77
When using `require`, how to find the file based on the input name.
8-
Setting this config to `?/init.lua` means that when you enter `require 'myfile'`, all `**/myfile/init.lua` will be searched from the loaded files.
8+
Setting this config to `?/init.lua` means that when you enter `require 'myfile'`, `${workspace}/myfile/init.lua` will be searched from the loaded files.
9+
if `runtime.pathStrict` is `false`, `${workspace}/**/myfile/init.lua` will also be searched.
910
If you want to load files outside the workspace, you need to set `Lua.workspace.library` first.
1011
]],
12+
['config.runtime.pathStrict'] = 'When enabled, `runtime.path` will only search the first level of directories, see the description of `runtime.path`.',
1113
["config.runtime.special"] = [[The custom global variables are regarded as some special built-in variables, and the language server will provide special support
1214
The following example shows that 'include' is treated as' require '.
1315
]] .. example.special,

0 commit comments

Comments
 (0)