diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-04-20 18:08:20 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-04-20 18:08:20 +0800 |
commit | 554ddae7b4174131fadf16bda5a32e5e967abda5 (patch) | |
tree | c72e26dfd25150eaff2e87683a3de8a74b3fb3db /script/vm | |
parent | 6846a670da889ae45228a91bdbca7e695ff97b69 (diff) | |
download | lua-language-server-554ddae7b4174131fadf16bda5a32e5e967abda5.zip |
guide -> searcher
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/eachDef.lua | 20 | ||||
-rw-r--r-- | script/vm/eachField.lua | 14 | ||||
-rw-r--r-- | script/vm/eachRef.lua | 18 | ||||
-rw-r--r-- | script/vm/getClass.lua | 12 | ||||
-rw-r--r-- | script/vm/getGlobals.lua | 4 | ||||
-rw-r--r-- | script/vm/getInfer.lua | 14 | ||||
-rw-r--r-- | script/vm/getLinks.lua | 8 | ||||
-rw-r--r-- | script/vm/guideInterface.lua | 6 |
8 files changed, 48 insertions, 48 deletions
diff --git a/script/vm/eachDef.lua b/script/vm/eachDef.lua index d72c8f01..a00b61bb 100644 --- a/script/vm/eachDef.lua +++ b/script/vm/eachDef.lua @@ -1,10 +1,10 @@ ---@type vm -local vm = require 'vm.vm' -local guide = require 'core.guide' -local files = require 'files' -local util = require 'utility' -local await = require 'await' -local config = require 'config' +local vm = require 'vm.vm' +local searcher = require 'core.searcher' +local files = require 'files' +local util = require 'utility' +local await = require 'await' +local config = require 'config' local function getDefs(source, deep) local results = {} @@ -18,9 +18,9 @@ local function getDefs(source, deep) deep = config.config.intelliSense.searchDepth + (deep or 0) local clock = os.clock() - local myResults, count = guide.requestDefinition(source, vm.interface, deep) + local myResults, count = searcher.requestDefinition(source, vm.interface, deep) if DEVELOP and os.clock() - clock > 0.1 then - log.warn('requestDefinition', count, os.clock() - clock, guide.getUri(source), util.dump(source, { deep = 1 })) + log.warn('requestDefinition', count, os.clock() - clock, searcher.getUri(source), util.dump(source, { deep = 1 })) end vm.mergeResults(results, myResults) @@ -31,8 +31,8 @@ end function vm.getDefs(source, deep) deep = deep or -999 - if guide.isGlobal(source) then - local key = guide.getKeyName(source) + if searcher.isGlobal(source) then + local key = searcher.getKeyName(source) if not key then return {} end diff --git a/script/vm/eachField.lua b/script/vm/eachField.lua index 59f35f0c..9a40fb1c 100644 --- a/script/vm/eachField.lua +++ b/script/vm/eachField.lua @@ -1,6 +1,6 @@ ---@type vm local vm = require 'vm.vm' -local guide = require 'core.guide' +local searcher= require 'core.searcher' local await = require 'await' local config = require 'config' @@ -19,7 +19,7 @@ local function getFields(source, deep, filterKey) deep = config.config.intelliSense.searchDepth + (deep or 0) await.delay() - local results = guide.requestFields(source, vm.interface, deep, filterKey) + local results = searcher.requestFields(source, vm.interface, deep, filterKey) unlock() return results @@ -40,7 +40,7 @@ local function getDefFields(source, deep, filterKey) deep = config.config.intelliSense.searchDepth + (deep or 0) await.delay() - local results = guide.requestDefFields(source, vm.interface, deep, filterKey) + local results = searcher.requestDefFields(source, vm.interface, deep, filterKey) unlock() return results @@ -76,8 +76,8 @@ function vm.getFields(source, deep) if source.special == '_G' then return vm.getGlobals '*' end - if guide.isGlobal(source) then - local name = guide.getKeyName(source) + if searcher.isGlobal(source) then + local name = searcher.getKeyName(source) if not name then return {} end @@ -94,8 +94,8 @@ function vm.getDefFields(source, deep) if source.special == '_G' then return vm.getGlobalSets '*' end - if guide.isGlobal(source) then - local name = guide.getKeyName(source) + if searcher.isGlobal(source) then + local name = searcher.getKeyName(source) if not name then return {} end diff --git a/script/vm/eachRef.lua b/script/vm/eachRef.lua index 9d0f061c..0556a6a3 100644 --- a/script/vm/eachRef.lua +++ b/script/vm/eachRef.lua @@ -1,9 +1,9 @@ ---@type vm -local vm = require 'vm.vm' -local guide = require 'core.guide' -local util = require 'utility' -local await = require 'await' -local config = require 'config' +local vm = require 'vm.vm' +local searcher = require 'core.searcher' +local util = require 'utility' +local await = require 'await' +local config = require 'config' local function getRefs(source, deep) local results = {} @@ -17,9 +17,9 @@ local function getRefs(source, deep) deep = config.config.intelliSense.searchDepth + (deep or 0) local clock = os.clock() - local myResults, count = guide.requestReference(source, vm.interface, deep) + local myResults, count = searcher.requestReference(source, vm.interface, deep) if DEVELOP and os.clock() - clock > 0.1 then - log.warn('requestReference', count, os.clock() - clock, guide.getUri(source), util.dump(source, { deep = 1 })) + log.warn('requestReference', count, os.clock() - clock, searcher.getUri(source), util.dump(source, { deep = 1 })) end vm.mergeResults(results, myResults) @@ -30,8 +30,8 @@ end function vm.getRefs(source, deep) deep = deep or -999 - if guide.isGlobal(source) then - local key = guide.getKeyName(source) + if searcher.isGlobal(source) then + local key = searcher.getKeyName(source) if not key then return {} end diff --git a/script/vm/getClass.lua b/script/vm/getClass.lua index 5c68e0bb..fbd50fc8 100644 --- a/script/vm/getClass.lua +++ b/script/vm/getClass.lua @@ -1,13 +1,13 @@ ---@type vm -local vm = require 'vm.vm' -local guide = require 'core.guide' +local vm = require 'vm.vm' +local searcher = require 'core.searcher' local function lookUpDocClass(source) local infers = vm.getInfers(source, 0) for _, infer in ipairs(infers) do if infer.source.type == 'doc.class' or infer.source.type == 'doc.type' then - return guide.viewInferType(infers) + return searcher.viewInferType(infers) end end return nil @@ -22,7 +22,7 @@ local function getClass(source, classes, depth, deep) if depth > 3 then return end - local value = guide.getObjectValue(source) or source + local value = searcher.getObjectValue(source) or source if not deep then if value and value.type == 'string' then classes[value[1]] = true @@ -38,7 +38,7 @@ local function getClass(source, classes, depth, deep) or lkey == '__name' or lkey == 'name' or lkey == 'class' then - local value = guide.getObjectValue(src) + local value = searcher.getObjectValue(src) if value and value.type == 'string' then classes[value[1]] = true end @@ -60,5 +60,5 @@ function vm.getClass(source, deep) if not next(classes) then return nil end - return guide.mergeTypes(classes) + return searcher.mergeTypes(classes) end diff --git a/script/vm/getGlobals.lua b/script/vm/getGlobals.lua index 75512a75..08f9d049 100644 --- a/script/vm/getGlobals.lua +++ b/script/vm/getGlobals.lua @@ -265,7 +265,7 @@ files.watch(function (ev, uri) end needUpdateGlobals[uri] = true elseif ev == 'create' then - getGlobalsOfFile(uri) - getGlobalSetsOfFile(uri) + --getGlobalsOfFile(uri) + --getGlobalSetsOfFile(uri) end end) diff --git a/script/vm/getInfer.lua b/script/vm/getInfer.lua index 5447ca23..be9a66ab 100644 --- a/script/vm/getInfer.lua +++ b/script/vm/getInfer.lua @@ -1,6 +1,6 @@ ---@type vm local vm = require 'vm.vm' -local guide = require 'core.guide' +local searcher= require 'core.searcher' local util = require 'utility' local await = require 'await' local config = require 'config' @@ -12,7 +12,7 @@ function vm.hasType(source, type, deep) local defs = vm.getDefs(source, deep) for i = 1, #defs do local def = defs[i] - local value = guide.getObjectValue(def) or def + local value = searcher.getObjectValue(def) or def if value.type == type then return true end @@ -34,7 +34,7 @@ end function vm.getInferType(source, deep) local infers = vm.getInfers(source, deep) - return guide.viewInferType(infers) + return searcher.viewInferType(infers) end function vm.getInferLiteral(source, deep) @@ -67,9 +67,9 @@ local function getInfers(source, deep) await.delay() local clock = os.clock() - local myResults, count = guide.requestInfer(source, vm.interface, deep) + local myResults, count = searcher.requestInfer(source, vm.interface, deep) if DEVELOP and os.clock() - clock > 0.1 then - log.warn('requestInfer', count, os.clock() - clock, guide.getUri(source), util.dump(source, { deep = 1 })) + log.warn('requestInfer', count, os.clock() - clock, searcher.getUri(source), util.dump(source, { deep = 1 })) end vm.mergeResults(results, myResults) @@ -92,8 +92,8 @@ end --- 获取对象的值 --- 会尝试穿透函数调用 function vm.getInfers(source, deep) - if guide.isGlobal(source) then - local name = guide.getKeyName(source) + if searcher.isGlobal(source) then + local name = searcher.getKeyName(source) local cache = vm.getCache('getInfersOfGlobal')[name] or getInfersBySource(source, deep) vm.getCache('getInfersOfGlobal')[name] = cache diff --git a/script/vm/getLinks.lua b/script/vm/getLinks.lua index 91a5f1a0..86a38cfc 100644 --- a/script/vm/getLinks.lua +++ b/script/vm/getLinks.lua @@ -1,7 +1,7 @@ -local guide = require 'core.guide' +local searcher = require 'core.searcher' ---@type vm -local vm = require 'vm.vm' -local files = require 'files' +local vm = require 'vm.vm' +local files = require 'files' local function getFileLinks(uri) local ws = require 'workspace' @@ -11,7 +11,7 @@ local function getFileLinks(uri) return links end tracy.ZoneBeginN('getFileLinks') - guide.eachSpecialOf(ast.ast, 'require', function (source) + searcher.eachSpecialOf(ast.ast, 'require', function (source) local call = source.parent if not call or call.type ~= 'call' then return diff --git a/script/vm/guideInterface.lua b/script/vm/guideInterface.lua index b966d5c9..e59fc6e3 100644 --- a/script/vm/guideInterface.lua +++ b/script/vm/guideInterface.lua @@ -2,7 +2,7 @@ local vm = require 'vm.vm' local files = require 'files' local ws = require 'workspace' -local guide = require 'core.guide' +local searcher = require 'core.searcher' local await = require 'await' local config = require 'config' @@ -27,7 +27,7 @@ function m.require(args, index) return nil end local results = {} - local myUri = guide.getUri(args[1]) + local myUri = searcher.getUri(args[1]) local uris = ws.findUrisByRequirePath(reqName) for _, uri in ipairs(uris) do if not files.eq(myUri, uri) then @@ -47,7 +47,7 @@ function m.dofile(args, index) return end local results = {} - local myUri = guide.getUri(args[1]) + local myUri = searcher.getUri(args[1]) local uris = ws.findUrisByFilePath(reqName) for _, uri in ipairs(uris) do if not files.eq(myUri, uri) then |