summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-12 09:50:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-12 09:50:28 +0800
commit8ae955d93b4450320f890cff66ade1610ca50fac (patch)
tree4011636a478692aef9a27cf490981fc3a98fc9e9
parent0f906e0a58328d5b3400a6645bec759198e5f469 (diff)
downloadlua-language-server-8ae955d93b4450320f890cff66ade1610ca50fac.zip
不要清空通知缓存;跳过大文件只通知前3个文件
-rw-r--r--script-beta/files.lua24
1 files changed, 14 insertions, 10 deletions
diff --git a/script-beta/files.lua b/script-beta/files.lua
index 42920478..181f4f66 100644
--- a/script-beta/files.lua
+++ b/script-beta/files.lua
@@ -170,7 +170,7 @@ function m.removeAll()
m.fileMap[uri] = nil
m.onWatch('remove', uri)
end
- m.notifyCache = {}
+ --m.notifyCache = {}
end
--- 遍历文件
@@ -195,18 +195,22 @@ function m.getAst(uri)
if #file.text >= config.config.workspace.preloadFileSize * 1000 then
if not m.notifyCache['preloadFileSize'] then
m.notifyCache['preloadFileSize'] = {}
+ m.notifyCache['skipLargeFileCount'] = 0
end
if not m.notifyCache['preloadFileSize'][uri] then
m.notifyCache['preloadFileSize'][uri] = true
- local ws = require 'workspace'
- proto.notify('window/showMessage', {
- type = 3,
- message = lang.script('WORKSPACE_SKIP_LARGE_FILE'
- , ws.getRelativePath(file.uri)
- , config.config.workspace.preloadFileSize
- , #file.text / 1000
- ),
- })
+ m.notifyCache['skipLargeFileCount'] = m.notifyCache['skipLargeFileCount'] + 1
+ if m.notifyCache['skipLargeFileCount'] <= 3 then
+ local ws = require 'workspace'
+ proto.notify('window/showMessage', {
+ type = 3,
+ message = lang.script('WORKSPACE_SKIP_LARGE_FILE'
+ , ws.getRelativePath(file.uri)
+ , config.config.workspace.preloadFileSize
+ , #file.text / 1000
+ ),
+ })
+ end
end
file.ast = nil
return nil