summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-11 17:02:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-11 17:02:42 +0800
commit599065480e33e21e66d307b06e8f8deae101756e (patch)
treeae97e27121d9c1be78ae6df5bb25dcc5f4e74e30 /script/workspace
parentbce8b096a5ccfffd928ba6e56980b62201c3d479 (diff)
downloadlua-language-server-599065480e33e21e66d307b06e8f8deae101756e.zip
fix #1034 don't require self
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/require-path.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/script/workspace/require-path.lua b/script/workspace/require-path.lua
index 56c94424..ca4a0e98 100644
--- a/script/workspace/require-path.lua
+++ b/script/workspace/require-path.lua
@@ -123,12 +123,14 @@ function m.findUrisByRequirePath(suri, path)
local clt = scope.getScope(suri):get('requireName')
if clt then
for _, uri in clt:each(suri, fspath) do
- local infos = m.getVisiblePath(suri, furi.decode(uri))
- for _, info in ipairs(infos) do
- local fsexpect = info.expect:gsub('%' .. separator, '/')
- if fsexpect == fspath then
- results[#results+1] = uri
- searchers[uri] = info.searcher
+ if uri ~= suri then
+ local infos = m.getVisiblePath(suri, furi.decode(uri))
+ for _, info in ipairs(infos) do
+ local fsexpect = info.expect:gsub('%' .. separator, '/')
+ if fsexpect == fspath then
+ results[#results+1] = uri
+ searchers[uri] = info.searcher
+ end
end
end
end