From 604d6a6aad7eaa173a4fb9d7dd49b8ac2f6976d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 13 Jan 2022 20:13:57 +0800 Subject: some fix --- script/provider/diagnostic.lua | 4 ++-- script/workspace/scope.lua | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'script') diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index 907ed55d..3152c332 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -350,7 +350,7 @@ function m.diagnosticsScope(uri, force) if not force and delay < 0 then return end - await.close ('diagnosticsScope:' .. uri) + await.close ('diagnosticsScope:' .. (uri or '')) await.call(function () ---@async await.sleep(math.max(delay, 0.1)) local clock = os.clock() @@ -377,7 +377,7 @@ function m.diagnosticsScope(uri, force) end bar:remove() log.debug('全文诊断耗时:', os.clock() - clock) - end, 'files.version', ('diagnosticsScope:' .. uri)) + end, 'files.version', ('diagnosticsScope:' .. (uri or ''))) end ws.watch(function (ev, uri) diff --git a/script/workspace/scope.lua b/script/workspace/scope.lua index fc71e60c..258f929c 100644 --- a/script/workspace/scope.lua +++ b/script/workspace/scope.lua @@ -25,6 +25,9 @@ end ---@param uri uri ---@return boolean function mt:isChildUri(uri) + if not uri then + return false + end if not self.uri then return true end @@ -34,6 +37,9 @@ end ---@param uri uri ---@return boolean function mt:isLinkedUri(uri) + if not uri then + return false + end for linkUri in pairs(self._links) do if uri:sub(1, #linkUri) == linkUri then return true -- cgit v1.2.3