diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-12-16 17:07:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-12-16 17:07:15 +0800 |
commit | 8b0d3827faf0cdc967e52ddfbe043c07c0dbe6a2 (patch) | |
tree | 34e869b1babfaf99ee04b752878ee53993303815 | |
parent | edf22aba16f36ca7784832f7bb6a550ac6ab1af2 (diff) | |
download | lua-language-server-8b0d3827faf0cdc967e52ddfbe043c07c0dbe6a2.zip |
#847 normalize `./`
-rw-r--r-- | script/workspace/workspace.lua | 1 | ||||
-rw-r--r-- | test/crossfile/definition.lua | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index ea2c4737..529c8936 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -488,6 +488,7 @@ function m.normalize(path) end end) path = util.expandPath(path) + path = path:gsub('^%.[/\\]+', '') if platform.OS == 'Windows' then path = path:gsub('[/\\]+', '\\') :gsub('[/\\]+$', '') diff --git a/test/crossfile/definition.lua b/test/crossfile/definition.lua index 058f5d18..b0cc232f 100644 --- a/test/crossfile/definition.lua +++ b/test/crossfile/definition.lua @@ -867,3 +867,28 @@ print(t.<?x?>) ]] } } + +local originRuntimePath = config.get 'Lua.runtime.path' +config.set('Lua.runtime.path', { + './?.lua' +}) + +TEST { + { + path = 'a.lua', + content = [[ +return { + <!x!> = 1, +} +]], + }, + { + path = 'b.lua', + content = [[ +local t = require 'a' +print(t.<?x?>) + ]] + } +} + +config.set('Lua.runtime.path', originRuntimePath) |