diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-01 01:08:30 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-01 01:08:30 +0800 |
commit | 8e41f1d067e3ce5f77bc9fe7c03d404da5553c60 (patch) | |
tree | 93f2852a80dbd8179e858b9683048120f58a878f /script | |
parent | 47e17129cd6d21eec1e8d9d402481153d4c8e0a3 (diff) | |
download | lua-language-server-8e41f1d067e3ce5f77bc9fe7c03d404da5553c60.zip |
update completion of enum
Diffstat (limited to 'script')
-rw-r--r-- | script/core/completion.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua index 5d32e659..d235f34c 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -891,21 +891,33 @@ local function checkEqualEnum(ast, text, offset, results) if not start then return end + local eqOrNeq if text:sub(start - 1, start - 1) == '=' or text:sub(start - 1, start - 1) == '~' then start = start - 1 + eqOrNeq = true end start = skipSpace(text, start - 1) local source = guide.eachSourceContain(ast.ast, start, function (source) + if source.finish ~= start then + return + end if source.type == 'getlocal' or source.type == 'setlocal' or source.type == 'local' or source.type == 'getglobal' or source.type == 'getfield' - or source.type == 'getindex' then + or source.type == 'getindex' + or source.type == 'call' then return source end end) + if not source then + return + end + if source.type == 'call' and not eqOrNeq then + return + end checkEqualEnumLeft(ast, text, offset, source, results) end |