diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-24 17:05:34 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-24 17:05:34 +0800 |
commit | 97513b61fa54fb57195ea867a1fa7cc16d3a8ad3 (patch) | |
tree | 48d6733b369090116739788910f1366e8595ac91 | |
parent | 32db4f5cc960a2ea7b3080c99d7ba2a8aca31171 (diff) | |
download | lua-language-server-97513b61fa54fb57195ea867a1fa7cc16d3a8ad3.zip |
use diagnostics.globals to get globals
-rw-r--r-- | script/parser/guide.lua | 2 | ||||
-rw-r--r-- | script/vm/getGlobals.lua | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/script/parser/guide.lua b/script/parser/guide.lua index feb9e170..8a852109 100644 --- a/script/parser/guide.lua +++ b/script/parser/guide.lua @@ -772,6 +772,8 @@ function m.getKeyName(obj) return 's|' .. obj.alias[1] elseif tp == 'doc.field' then return 's|' .. obj.field[1] + elseif tp == 'dummy' then + return 's|' .. obj[1] end return m.getKeyNameOfLiteral(obj) end diff --git a/script/vm/getGlobals.lua b/script/vm/getGlobals.lua index 0ce325c7..26d10a64 100644 --- a/script/vm/getGlobals.lua +++ b/script/vm/getGlobals.lua @@ -84,6 +84,16 @@ local function getGlobals(name) end end end + for key in pairs(config.config.diagnostics.globals) do + if name == '*' or name == key then + results[#results+1] = { + type = 'dummy', + start = 0, + finish = 0, + [1] = key + } + end + end return results end @@ -105,6 +115,16 @@ local function getGlobalSets(name) end end end + for key in pairs(config.config.diagnostics.globals) do + if name == '*' or name == key then + results[#results+1] = { + type = 'dummy', + start = 0, + finish = 0, + [1] = key + } + end + end return results end |