summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-09 17:01:22 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-09 17:01:22 +0800
commit06a80f826d74478d2fe0c28a00c2d0c3c8b9b7e5 (patch)
tree1d3023a83097456efc667efcd7e1278936e8e6d8 /script
parent2e76da9f371bccd35e3da80b3a2af60a703f627c (diff)
downloadlua-language-server-06a80f826d74478d2fe0c28a00c2d0c3c8b9b7e5.zip
fix
Diffstat (limited to 'script')
-rw-r--r--script/workspace/require-path.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua
index 963cc6d7..8e5b67dc 100644
--- a/script/workspace/require-path.lua
+++ b/script/workspace/require-path.lua
@@ -39,19 +39,20 @@ function m.getVisiblePath(path, searchers, strict)
local isAbsolute = searcher:match '^[/\\]'
or searcher:match '^%a+%:'
local cutedPath = path
+ local currentPath = path
local head
local pos = 1
if not isAbsolute then
if libraryPath then
pos = #libraryPath + 2
else
- path = workspace.getRelativePath(uri)
+ currentPath = workspace.getRelativePath(uri)
end
end
repeat
- cutedPath = path:sub(pos)
- head = path:sub(1, pos - 1)
- pos = path:match('[/\\]+()', pos)
+ cutedPath = currentPath:sub(pos)
+ head = currentPath:sub(1, pos - 1)
+ pos = currentPath:match('[/\\]+()', pos)
if platform.OS == 'Windows' then
searcher = searcher :gsub('[/\\]+', '\\')
:gsub('^[/\\]+', '')