diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-16 01:58:46 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-16 01:58:46 +0800 |
commit | c3cec6c8cd20c319c291431fbec55f1d1d596c6d (patch) | |
tree | 55047c4bac77a2bf3d82d1286612cdd799c18949 /script-beta | |
parent | bb1e4a1d0ef31d0ed5d82df22a103cecfe79b251 (diff) | |
download | lua-language-server-c3cec6c8cd20c319c291431fbec55f1d1d596c6d.zip |
限制回看层级
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/parser/guide.lua | 15 | ||||
-rw-r--r-- | script-beta/provider/diagnostic.lua | 3 | ||||
-rw-r--r-- | script-beta/workspace/workspace.lua | 7 |
3 files changed, 21 insertions, 4 deletions
diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 5e7a731a..32f5107e 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1387,6 +1387,15 @@ function m.checkSameSimpleAsTableField(status, ref, start, queue) end end +function m.checkBackCount(status) + status.cache.back = status.cache.back or 0 + if status.cache.back >= (status.interface.backlimit or 0) then + return true + end + status.cache.back = status.cache.back + 1 + return false +end + function m.checkSameSimpleAsReturn(status, ref, start, queue) if ref.parent.type ~= 'return' then return @@ -1396,6 +1405,9 @@ function m.checkSameSimpleAsReturn(status, ref, start, queue) if ref.parent.parent.type ~= 'main' then return end + if m.checkBackCount(status) then + return + end local newStatus = m.status(status) m.searchRefsAsFunctionReturn(newStatus, ref, 'ref') for _, res in ipairs(newStatus.results) do @@ -1420,6 +1432,9 @@ function m.checkSameSimpleAsSetValue(status, ref, start, queue) if m.checkValueMark(status, ref, parent) then return end + if m.checkBackCount(status) then + return + end local obj if parent.type == 'local' or parent.type == 'setglobal' diff --git a/script-beta/provider/diagnostic.lua b/script-beta/provider/diagnostic.lua index 34cec966..9e1ae0d1 100644 --- a/script-beta/provider/diagnostic.lua +++ b/script-beta/provider/diagnostic.lua @@ -205,14 +205,15 @@ function m.refresh(uri) end function m.diagnosticsAll() + local clock = os.clock() for uri in files.eachFile() do m.doDiagnostic(uri) end + log.debug('全文诊断耗时:', os.clock() - clock) end function m.start() m._start = true - m.diagnosticsAll() end diff --git a/script-beta/workspace/workspace.lua b/script-beta/workspace/workspace.lua index 70f5616b..89470beb 100644 --- a/script-beta/workspace/workspace.lua +++ b/script-beta/workspace/workspace.lua @@ -134,9 +134,7 @@ function m.awaitPreload() if read >= max then break end - await.sleep(0.1, function () - return m.preloadVersion - end) + await.sleep(0.1) end log.info('Preload finish.') @@ -201,6 +199,9 @@ function m.reload() m.preloadVersion = m.preloadVersion + 1 files.removeAll() await.create(function () + await.setDelayer(function () + return m.preloadVersion + end) m.awaitPreload() end) end |