summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-18 20:59:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-18 20:59:16 +0800
commit4f1f6d4dbc7940b5f117e25b3528712ff4b221ef (patch)
tree49f932fc61e1ccd0621a19652d557b79bd576351 /script
parent82190ca9d352030ba86081f58517d9e6afe43b00 (diff)
downloadlua-language-server-4f1f6d4dbc7940b5f117e25b3528712ff4b221ef.zip
fix
Diffstat (limited to 'script')
-rw-r--r--script/workspace/workspace.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 72a689c1..5350369e 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -329,11 +329,7 @@ function m.findUrisByFilePath(path)
if type(path) ~= 'string' then
return {}
end
- local lpath = path:gsub('[/\\]+', '/')
- if lpath:match('^[/\\]')
- or lpath:match('^%a+%:') then
- lpath = furi.encode(lpath)
- end
+ local lpath = furi.encode(path):gsub('^file:///', '')
if platform.OS == 'Windows' then
lpath = lpath:lower()
end
@@ -349,11 +345,11 @@ function m.findUrisByFilePath(path)
if platform.OS ~= 'Windows' then
uri = files.getOriginUri(uri)
end
- local curPath = furi.decode(files.getOriginUri(uri))
- if not curPath:find(lpath, 1, true) then
+ if not uri:find(lpath, 1, true) then
goto CONTINUE
end
local pathLen = #path
+ local curPath = furi.decode(files.getOriginUri(uri))
local curLen = #curPath
local seg = curPath:sub(curLen - pathLen, curLen - pathLen)
if seg == '/' or seg == '\\' or seg == '' then