diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-23 19:34:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-23 19:34:57 +0800 |
commit | d2667b5943f41ec16b5e54a4d64c497bef149b59 (patch) | |
tree | 21a9a2686304908b8e5c48014f217279723ac81e /script/vm | |
parent | ad72c1fdc4e8d1fb9afca2dbe10e3c425ead4786 (diff) | |
download | lua-language-server-d2667b5943f41ec16b5e54a4d64c497bef149b59.zip |
cleanup
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/getDocs.lua | 1 | ||||
-rw-r--r-- | script/vm/getGlobals.lua | 1 | ||||
-rw-r--r-- | script/vm/getLinks.lua | 1 | ||||
-rw-r--r-- | script/vm/guideInterface.lua | 115 | ||||
-rw-r--r-- | script/vm/init.lua | 1 |
5 files changed, 3 insertions, 116 deletions
diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua index a354e214..8be543fe 100644 --- a/script/vm/getDocs.lua +++ b/script/vm/getDocs.lua @@ -1,5 +1,6 @@ local files = require 'files' local guide = require 'parser.guide' +---@type vm local vm = require 'vm.vm' local config = require 'config' local collector = require 'core.collector' diff --git a/script/vm/getGlobals.lua b/script/vm/getGlobals.lua index abc765cb..f32a84b1 100644 --- a/script/vm/getGlobals.lua +++ b/script/vm/getGlobals.lua @@ -1,4 +1,5 @@ local collector = require 'core.collector' +---@type vm local vm = require 'vm.vm' local noder = require 'core.noder' diff --git a/script/vm/getLinks.lua b/script/vm/getLinks.lua index 14b34987..62e9d8af 100644 --- a/script/vm/getLinks.lua +++ b/script/vm/getLinks.lua @@ -1,4 +1,5 @@ local guide = require 'parser.guide' +---@type vm local vm = require 'vm.vm' local files = require 'files' diff --git a/script/vm/guideInterface.lua b/script/vm/guideInterface.lua deleted file mode 100644 index a07b6644..00000000 --- a/script/vm/guideInterface.lua +++ /dev/null @@ -1,115 +0,0 @@ ----@type vm -local vm = require 'vm.vm' -local files = require 'files' -local ws = require 'workspace' -local searcher = require 'core.searcher' -local await = require 'await' -local config = require 'config' - -local m = {} - -function m.searchFileReturn(results, ast, index) - local returns = ast.returns - if not returns then - return - end - for _, ret in ipairs(returns) do - local exp = ret[index] - if exp then - vm.mergeResults(results, { exp }) - end - end -end - -function m.require(args, index) - local reqName = args and args[1] and args[1][1] - if not reqName then - return nil - end - local results = {} - local myUri = searcher.getUri(args[1]) - local uris = ws.findUrisByRequirePath(reqName) - for _, uri in ipairs(uris) do - if not files.eq(myUri, uri) then - local ast = files.getState(uri) - if ast then - m.searchFileReturn(results, ast.ast, index) - end - end - end - - return results -end - -function m.dofile(args, index) - local reqName = args and args[1] and args[1][1] - if not reqName then - return - end - local results = {} - local myUri = searcher.getUri(args[1]) - local uris = ws.findUrisByFilePath(reqName) - for _, uri in ipairs(uris) do - if not files.eq(myUri, uri) then - local ast = files.getState(uri) - if ast then - m.searchFileReturn(results, ast.ast, index) - end - end - end - return results -end - -vm.interface = {} - --- 向前寻找引用的层数限制,一般情况下都为0 --- 在自动完成/漂浮提示等情况时设置为5(需要清空缓存) --- 在查找引用时设置为10(需要清空缓存) -vm.interface.searchLevel = 0 - -function vm.interface.call(func, args, index) - if func.special == 'require' and index == 1 then - await.delay() - return m.require(args, index) - end - if func.special == 'dofile' then - await.delay() - return m.dofile(args, index) - end -end - -function vm.interface.global(name, onlyDef) - await.delay() - if onlyDef then - return vm.getGlobalSets(name) - else - return vm.getGlobals(name) - end -end - -function vm.interface.doc(name, type) - await.delay() - return vm.getDocNames(name, type) -end - -function vm.interface.link(uri) - await.delay() - return vm.getLinksTo(uri) -end - -function vm.interface.index(obj) - return nil -end - -function vm.interface.cache() - await.delay() - return vm.getCache('cache') -end - -function vm.interface.getSearchDepth() - return config.config.intelliSense.searchDepth -end - -function vm.interface.pulse() - await.delay() -end diff --git a/script/vm/init.lua b/script/vm/init.lua index c38f01d5..935f39e3 100644 --- a/script/vm/init.lua +++ b/script/vm/init.lua @@ -5,5 +5,4 @@ require 'vm.getLibrary' require 'vm.eachDef' require 'vm.eachRef' require 'vm.getLinks' -require 'vm.guideInterface' return vm |