From c3cec6c8cd20c319c291431fbec55f1d1d596c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Sun, 16 Aug 2020 01:58:46 +0800 Subject: =?UTF-8?q?=E9=99=90=E5=88=B6=E5=9B=9E=E7=9C=8B=E5=B1=82=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main-beta.lua | 4 ++-- script-beta/parser/guide.lua | 15 +++++++++++++++ script-beta/provider/diagnostic.lua | 3 ++- script-beta/workspace/workspace.lua | 7 ++++--- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/main-beta.lua b/main-beta.lua index 424ecd14..c1b9d864 100644 --- a/main-beta.lua +++ b/main-beta.lua @@ -5,8 +5,8 @@ local fs = require 'bee.filesystem' ROOT = fs.path(rootPath) LANG = LANG or 'en-US' -debug.setcstacklimit(500) -collectgarbage('generational', 10, 50) +debug.setcstacklimit(1000) +--collectgarbage('generational', 10, 50) --collectgarbage('incremental', 120, 120, 0) log = require 'log' 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 -- cgit v1.2.3