diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-05 17:15:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-05 17:15:05 +0800 |
commit | cb30a8f68bb18e210a2a2853aaaa583507bdf1b8 (patch) | |
tree | 21899cc66fd5375cfe0d38dcb4030bc64c8ea3ba /script-beta | |
parent | dbb99f3919751bea59e8ffffcda9bb968c74a8f5 (diff) | |
download | lua-language-server-cb30a8f68bb18e210a2a2853aaaa583507bdf1b8.zip |
性能相关的选项
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/config.lua | 5 | ||||
-rw-r--r-- | script-beta/core/completion.lua | 7 | ||||
-rw-r--r-- | script-beta/core/hover/table.lua | 2 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 3 | ||||
-rw-r--r-- | script-beta/provider/provider.lua | 5 | ||||
-rw-r--r-- | script-beta/vm/guideInterface.lua | 4 |
6 files changed, 23 insertions, 3 deletions
diff --git a/script-beta/config.lua b/script-beta/config.lua index 02f4cf25..8927f9b1 100644 --- a/script-beta/config.lua +++ b/script-beta/config.lua @@ -140,6 +140,7 @@ local ConfigTemplate = { viewString = {true, Boolean}, viewStringMax = {1000, Integer}, viewNumber = {true, Boolean}, + fieldInfer = {3000, Integer}, }, color = { mode = {'Semantic', String}, @@ -151,6 +152,10 @@ local ConfigTemplate = { enable = {false, Boolean}, path = {'.vscode/lua-plugin/*.lua', String}, }, + intelliSense = { + searchDepth = {0, Integer}, + fastGlobal = {true, Boolean}, + }, } local OtherTemplate = { diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 4f4f99c7..5dc8d80c 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -451,7 +451,12 @@ local function checkField(ast, word, start, offset, parent, oop, results) end local function checkGlobal(ast, word, start, offset, parent, oop, results) - local refs = vm.getGlobals('*', 'fast') + local refs + if config.config.intelliSense.fastGlobal then + refs = vm.getGlobals('*', 'fast') + else + refs = vm.getGlobals('*') + end checkFieldOfRefs(refs, ast, word, start, offset, parent, oop, results) end diff --git a/script-beta/core/hover/table.lua b/script-beta/core/hover/table.lua index 35a5f337..75342925 100644 --- a/script-beta/core/hover/table.lua +++ b/script-beta/core/hover/table.lua @@ -240,7 +240,7 @@ return function (source) if not literals[key] then literals[key] = {} end - if not TEST and os.clock() - clock > 3 then + if not TEST and os.clock() - clock > config.config.hover.fieldInfer / 1000.0 then timeUp = true end local class, literal = getField(src, timeUp, mark, key) diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index f52e9545..9e9b085c 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1194,7 +1194,8 @@ function m.status(parentStatus, interface) deep = parentStatus and parentStatus.deep, results = {}, } - if status.depth >= 5 then + local searchDepth = interface and interface.searchDepth or 0 + if status.depth >= searchDepth then status.deep = false end status.lock = status.locks[status.depth] or {} diff --git a/script-beta/provider/provider.lua b/script-beta/provider/provider.lua index c892bfee..46136f54 100644 --- a/script-beta/provider/provider.lua +++ b/script-beta/provider/provider.lua @@ -18,6 +18,7 @@ local lang = require 'language' local function updateConfig() local diagnostics = require 'provider.diagnostic' + local vm = require 'vm' local configs = proto.awaitRequest('workspace/configuration', { items = { { @@ -65,6 +66,10 @@ local function updateConfig() if not util.equal(oldConfig.luadoc, newConfig.luadoc) then files.flushCache() end + if not util.equal(oldConfig.intelliSense, newConfig.intelliSense) then + files.flushCache() + vm.setSearchDepth(newConfig.intelliSense.searchDepth) + end if newConfig.completion.enable then completion.enable() diff --git a/script-beta/vm/guideInterface.lua b/script-beta/vm/guideInterface.lua index 4d651882..ddacf091 100644 --- a/script-beta/vm/guideInterface.lua +++ b/script-beta/vm/guideInterface.lua @@ -128,3 +128,7 @@ function vm.setSearchLevel(n) end vm.interface.searchLevel = n end + +function vm.setSearchDepth(n) + vm.interface.setSearchDepth = n +end |