summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorFolke Lemaitre <folke.lemaitre@gmail.com>2022-09-26 08:49:36 +0200
committerFolke Lemaitre <folke.lemaitre@gmail.com>2022-09-26 10:46:57 +0200
commite4f80b9523f4ee9b0430e9d746af47be78f4e326 (patch)
tree69e0c326e62ec711983f84b816ecff44cc25ae65 /script
parent3ddd84c8ca307378a2c949377831efe7afa7a4ee (diff)
downloadlua-language-server-e4f80b9523f4ee9b0430e9d746af47be78f4e326.zip
fix: pathStrict should also look for strict path uris in workspace libraries
Diffstat (limited to 'script')
-rw-r--r--script/workspace/require-path.lua30
1 files changed, 15 insertions, 15 deletions
diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua
index 1b7b25f9..1e7c81e5 100644
--- a/script/workspace/require-path.lua
+++ b/script/workspace/require-path.lua
@@ -179,21 +179,21 @@ function mt:findUrisByRequireName(suri, name)
searcherMap[fullUri] = searcher
end
end
- if not strict then
- local tail = '/' .. furi.encode(fspath):gsub('^file:[/]*', '')
- for uri in files.eachFile(self.scp.uri) do
- if not searcherMap[uri]
- and suri ~= uri
- and util.stringEndWith(uri, tail) then
- results[#results+1] = uri
- local parentUri = files.getLibraryUri(self.scp.uri, uri) or self.scp.uri
- if parentUri == nil or parentUri == '' then
- parentUri = furi.encode ''
- end
- local relative = uri:sub(#parentUri + 1):sub(1, - #tail)
- searcherMap[uri] = workspace.normalize(relative .. searcher)
- end
- end
+ local tail = '/' .. furi.encode(fspath):gsub('^file:[/]*', '')
+ for uri in files.eachFile(self.scp.uri) do
+ if not searcherMap[uri]
+ and suri ~= uri
+ and util.stringEndWith(uri, tail) then
+ local parentUri = files.getLibraryUri(self.scp.uri, uri) or self.scp.uri
+ if parentUri == nil or parentUri == '' then
+ parentUri = furi.encode ''
+ end
+ local relative = uri:sub(#parentUri + 1):sub(1, - #tail)
+ if not strict or relative == "/" then
+ results[#results+1] = uri
+ end
+ searcherMap[uri] = workspace.normalize(relative .. searcher)
+ end
end
end