diff options
-rw-r--r-- | main-beta.lua | 4 | ||||
-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 |
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 |