diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-28 15:45:07 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-28 15:45:07 +0800 |
commit | bdc9f6d325362b8f834cb1d5e9be1911226d1961 (patch) | |
tree | 2a2868750d0db8663cbcf8ae4982d98d589da5fa | |
parent | 416928fd0cef29591cf404e248cc92eada5a535f (diff) | |
download | lua-language-server-bdc9f6d325362b8f834cb1d5e9be1911226d1961.zip |
add max preload
-rw-r--r-- | script/workspace/workspace.lua | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 07a53370..90db1f0c 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -12,6 +12,7 @@ local library = require 'library' local sp = require 'bee.subprocess' local timer = require 'timer' local progress = require 'progress' +local define = require "proto.define" local m = {} m.type = 'workspace' @@ -179,10 +180,31 @@ local function loadFileFactory(root, progressData, isLibrary) if not isLibrary and progressData.preload >= config.config.workspace.maxPreload then if not m.hasHitMaxPreload then m.hasHitMaxPreload = true - proto.notify('window/showMessage', { - type = 3, + local item = proto.awaitRequest('window/showMessageRequest', { + type = define.MessageType.Info, message = lang.script('MWS_MAX_PRELOAD', config.config.workspace.maxPreload), + actions = { + { + title = '增加上限', + }, + { + title = '关闭', + } + } }) + if not item then + return + end + if item.title == '增加上限' then + proto.notify('$/command', { + command = 'lua.config', + data = { + key = 'Lua.workspace.maxPreload', + action = 'set', + value = config.config.workspace.maxPreload * 2, + } + }) + end end return end @@ -409,6 +431,7 @@ function m.awaitReload() local rpath = require 'workspace.require-path' local plugin = require 'plugin' m.ready = false + m.hasHitMaxPreload = false files.flushAllLibrary() files.removeAllClosed() files.flushCache() |