diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-05-18 14:56:40 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-05-18 14:56:40 +0800 |
commit | f8917bd6dcb97b1b19c5252952988aaa68c7081a (patch) | |
tree | a78c81e68556d78931e4586b042edbc99e327686 /script/provider | |
parent | 920f252f0ea57615600258b301917e6b3fab0bdc (diff) | |
download | lua-language-server-f8917bd6dcb97b1b19c5252952988aaa68c7081a.zip |
fix #539
Diffstat (limited to 'script/provider')
-rw-r--r-- | script/provider/provider.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua index a6f4d9cc..3ac71d8b 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -458,17 +458,18 @@ proto.on('textDocument/completion', function (params) if not files.exists(uri) then return nil end - if params.context and config.other.acceptSuggestionOnEnter ~= 'off' then - if params.context.triggerCharacter == '\n' - or params.context.triggerCharacter == '{' - or params.context.triggerCharacter == ',' then + local triggerCharacter = params.context and params.context.triggerCharacter + if config.other.acceptSuggestionOnEnter ~= 'off' then + if triggerCharacter == '\n' + or triggerCharacter == '{' + or triggerCharacter == ',' then return end end await.setPriority(1000) local clock = os.clock() local offset = files.offset(uri, params.position) - local result = core.completion(uri, offset - 1) + local result = core.completion(uri, offset - 1, triggerCharacter) local passed = os.clock() - clock if passed > 0.1 then log.warn(('Completion takes %.3f sec.'):format(passed)) |