diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-16 14:18:48 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-16 14:18:48 +0800 |
commit | 45b8a1d0cb6e0a7fc160a4fc0a4a47469bbac1d4 (patch) | |
tree | 3109b50ca330517383958a444867a673de40f7ac | |
parent | 7e97893e92f694b65f58630cba04d0732ca75e23 (diff) | |
download | lua-language-server-45b8a1d0cb6e0a7fc160a4fc0a4a47469bbac1d4.zip |
支持将自定义函数识别为special
-rw-r--r-- | .vscode/launch.json | 2 | ||||
-rw-r--r-- | script-beta/parser/compile.lua | 9 | ||||
-rw-r--r-- | script-beta/vm/getLibrary.lua | 6 |
3 files changed, 16 insertions, 1 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json index 0e1fa7d8..62923b5d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -48,7 +48,7 @@ "type": "lua", "request": "attach", "stopOnEntry": true, - "address": "127.0.0.1:11409", + "address": "127.0.0.1:11427", "outputCapture": [ ] }, diff --git a/script-beta/parser/compile.lua b/script-beta/parser/compile.lua index f2a78c28..2c7172e8 100644 --- a/script-beta/parser/compile.lua +++ b/script-beta/parser/compile.lua @@ -212,6 +212,15 @@ local vmMap = { if node then addRef(node, obj) end + local name = obj[1] + if specials[name] then + addSpecial(name, obj) + elseif Options and Options.special then + local asName = Options.special[name] + if specials[asName] then + addSpecial(asName, obj) + end + end end end, ['local'] = function (obj) diff --git a/script-beta/vm/getLibrary.lua b/script-beta/vm/getLibrary.lua index 86f1ae58..eaeeafa3 100644 --- a/script-beta/vm/getLibrary.lua +++ b/script-beta/vm/getLibrary.lua @@ -60,6 +60,12 @@ function vm.getLibraryName(source, deep) if lib then return lib.name end + local defs = vm.getDefs(source, deep) + for _, def in ipairs(defs) do + if def.special then + return def.special + end + end return nil end |