diff options
author | Folke Lemaitre <folke.lemaitre@gmail.com> | 2022-09-26 08:49:36 +0200 |
---|---|---|
committer | Folke Lemaitre <folke.lemaitre@gmail.com> | 2022-09-26 10:46:57 +0200 |
commit | e4f80b9523f4ee9b0430e9d746af47be78f4e326 (patch) | |
tree | 69e0c326e62ec711983f84b816ecff44cc25ae65 /script | |
parent | 3ddd84c8ca307378a2c949377831efe7afa7a4ee (diff) | |
download | lua-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.lua | 30 |
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 |