diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-01-21 16:59:17 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-01-21 16:59:17 +0800 |
commit | 3778e5eeb3ffe35e5a5f70700635a90970a2ee40 (patch) | |
tree | 5c9923a155edd332778c7e2318f73c42b9d5fb65 /script/core | |
parent | 021ceef2e05c781e849e1bac86eaae6e36775cf9 (diff) | |
download | lua-language-server-3778e5eeb3ffe35e5a5f70700635a90970a2ee40.zip |
Avoid O(n^2) `require` computations
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/collector.lua | 3 | ||||
-rw-r--r-- | script/core/completion/completion.lua | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/script/core/collector.lua b/script/core/collector.lua index 62ca5a7d..1abfc51b 100644 --- a/script/core/collector.lua +++ b/script/core/collector.lua @@ -42,6 +42,9 @@ function mt:dropUri(uri) self.subscribed[uri] = nil for name in pairs(uriSubscribed) do self.collect[name][uri] = nil + if not next(self.collect[name]) then + self.collect[name] = nil + end end end diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua index 124ebee1..9eb33c2a 100644 --- a/script/core/completion/completion.lua +++ b/script/core/completion/completion.lua @@ -884,7 +884,7 @@ local function collectRequireNames(mode, myUri, literal, source, smark, position if myUri == uri then goto CONTINUE end - local path = workspace.getRelativePath(uri) + local path = furi.decode(uri) local infos = rpath.getVisiblePath(uri, path) for _, info in ipairs(infos) do if matchKey(literal, info.expect) then |