diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-05 17:29:15 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-05 17:29:15 +0800 |
commit | 90b3e60098e05375ac721b7e655c2cb63ae227f3 (patch) | |
tree | 1fc707fbec3f88aa51ec0743421f8414827d20f4 /script-beta | |
parent | 605ed7e981b42507ae27e494617f5b3da3c2ece1 (diff) | |
download | lua-language-server-90b3e60098e05375ac721b7e655c2cb63ae227f3.zip |
整理代码
Diffstat (limited to 'script-beta')
-rw-r--r-- | script-beta/core/completion.lua | 1 | ||||
-rw-r--r-- | script-beta/core/definition.lua | 1 | ||||
-rw-r--r-- | script-beta/core/hover/init.lua | 1 | ||||
-rw-r--r-- | script-beta/core/reference.lua | 1 | ||||
-rw-r--r-- | script-beta/core/rename.lua | 1 | ||||
-rw-r--r-- | script-beta/parser/guide.lua | 4 | ||||
-rw-r--r-- | script-beta/provider/provider.lua | 1 | ||||
-rw-r--r-- | script-beta/vm/guideInterface.lua | 13 |
8 files changed, 4 insertions, 19 deletions
diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 5dc8d80c..4c81439b 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -1219,7 +1219,6 @@ local function completion(uri, offset) local text = files.getText(uri) local results = {} clearStack() - vm.setSearchLevel(3) if ast then if getComment(ast, offset) then tryLuaDoc(ast, text, offset, results) diff --git a/script-beta/core/definition.lua b/script-beta/core/definition.lua index eb8f2715..63af4034 100644 --- a/script-beta/core/definition.lua +++ b/script-beta/core/definition.lua @@ -124,7 +124,6 @@ return function (uri, offset) end end - vm.setSearchLevel(10) for _, src in ipairs(vm.getDefs(source, 'deep')) do local root = guide.getRoot(src) if not root then diff --git a/script-beta/core/hover/init.lua b/script-beta/core/hover/init.lua index 3876ab58..6436169a 100644 --- a/script-beta/core/hover/init.lua +++ b/script-beta/core/hover/init.lua @@ -93,7 +93,6 @@ local function getHover(source) if source.type == 'doc.type.name' then return getHoverAsDocName(source) end - vm.setSearchLevel(5) local isFunction = vm.hasInferType(source, 'function', 'deep') if isFunction then return getHoverAsFunction(source) diff --git a/script-beta/core/reference.lua b/script-beta/core/reference.lua index 0e3268f5..57b06a84 100644 --- a/script-beta/core/reference.lua +++ b/script-beta/core/reference.lua @@ -70,7 +70,6 @@ return function (uri, offset) end local results = {} - vm.setSearchLevel(10) for _, src in ipairs(vm.getRefs(source, 'deep')) do local root = guide.getRoot(src) if not root then diff --git a/script-beta/core/rename.lua b/script-beta/core/rename.lua index 720d8b0c..bb722126 100644 --- a/script-beta/core/rename.lua +++ b/script-beta/core/rename.lua @@ -372,7 +372,6 @@ function m.rename(uri, pos, newname) local results = {} local mark = {} - vm.setSearchLevel(3) rename(source, newname, function (target, start, finish, text) if mark[start] then return diff --git a/script-beta/parser/guide.lua b/script-beta/parser/guide.lua index 9e9b085c..e1eaf345 100644 --- a/script-beta/parser/guide.lua +++ b/script-beta/parser/guide.lua @@ -1181,8 +1181,6 @@ function m.getSimple(obj, max) return simpleList end -m.Version = 53 - function m.status(parentStatus, interface) local status = { cache = parentStatus and parentStatus.cache or { @@ -1194,7 +1192,7 @@ function m.status(parentStatus, interface) deep = parentStatus and parentStatus.deep, results = {}, } - local searchDepth = interface and interface.searchDepth or 0 + local searchDepth = interface and interface.getSearchDepth() or 0 if status.depth >= searchDepth then status.deep = false end diff --git a/script-beta/provider/provider.lua b/script-beta/provider/provider.lua index 46136f54..a42dd2b6 100644 --- a/script-beta/provider/provider.lua +++ b/script-beta/provider/provider.lua @@ -68,7 +68,6 @@ local function updateConfig() end if not util.equal(oldConfig.intelliSense, newConfig.intelliSense) then files.flushCache() - vm.setSearchDepth(newConfig.intelliSense.searchDepth) end if newConfig.completion.enable then diff --git a/script-beta/vm/guideInterface.lua b/script-beta/vm/guideInterface.lua index ddacf091..6ecae5a8 100644 --- a/script-beta/vm/guideInterface.lua +++ b/script-beta/vm/guideInterface.lua @@ -4,6 +4,7 @@ local ws = require 'workspace' local guide = require 'parser.guide' local await = require 'await' local library = require 'library' +local config = require 'config' local m = {} @@ -121,14 +122,6 @@ function vm.interface.cache() return vm.getCache('cache') end -function vm.setSearchLevel(n) - -- 只有在搜索等级由低变高时,才需要清空缓存 - if n > vm.interface.searchLevel then - --vm.flushCache() - end - vm.interface.searchLevel = n -end - -function vm.setSearchDepth(n) - vm.interface.setSearchDepth = n +function vm.interface.getSearchDepth() + return config.config.intelliSense.searchDepth end |