summaryrefslogtreecommitdiff
path: root/script/workspace/scope.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-10-11 16:19:08 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-10-11 16:19:08 +0800
commite82c09fd0b06e8d4ca872759fb6bb4d50506dd6a (patch)
treea126cdd41e72a1a45db6cdf875c2c0d021a2ce1c /script/workspace/scope.lua
parent8ec593e83fff0ba00466361cdee5dece07c5d98e (diff)
downloadlua-language-server-e82c09fd0b06e8d4ca872759fb6bb4d50506dd6a.zip
fix #1567
Diffstat (limited to 'script/workspace/scope.lua')
-rw-r--r--script/workspace/scope.lua18
1 files changed, 16 insertions, 2 deletions
diff --git a/script/workspace/scope.lua b/script/workspace/scope.lua
index 4649d354..e6fcfeb7 100644
--- a/script/workspace/scope.lua
+++ b/script/workspace/scope.lua
@@ -46,7 +46,17 @@ function mt:isChildUri(uri)
if not self.uri then
return false
end
- return uri:sub(1, #self.uri) == self.uri
+ if self.uri == '' then
+ return true
+ end
+ if self.uri == uri then
+ return true
+ end
+ if uri:sub(1, #self.uri) == self.uri
+ and uri:sub(#self.uri + 1, #self.uri + 1) == '/' then
+ return true
+ end
+ return false
end
---@param uri uri
@@ -56,7 +66,11 @@ function mt:isLinkedUri(uri)
return false
end
for linkUri in pairs(self._links) do
- if uri:sub(1, #linkUri) == linkUri then
+ if uri == linkUri then
+ return true
+ end
+ if uri:sub(1, #linkUri) == linkUri
+ and uri:sub(#linkUri + 1, #linkUri + 1) == '/' then
return true
end
end