diff options
author | Nathan Craddock <nzcraddock@gmail.com> | 2021-08-19 09:02:47 -0600 |
---|---|---|
committer | Nathan Craddock <nzcraddock@gmail.com> | 2021-08-19 09:02:47 -0600 |
commit | 0ae22219224227d756b956b9988b55e9ec66fed6 (patch) | |
tree | 17b5be35e59460691bec6f2ed71092fb1890ed79 /script | |
parent | 822e794883b41bf5e8758cce5d4601a69f3ee874 (diff) | |
download | lua-language-server-0ae22219224227d756b956b9988b55e9ec66fed6.zip |
Change completion.word to completion.showWord
Updates the config option from a boolean to a string that has three
supported values:
* Disable: Never show text completions
* Enable: Always show text completions
* Fallback: Only show text completions as a fallback when there are no
semantic completions found.
Diffstat (limited to 'script')
-rw-r--r-- | script/config/config.lua | 2 | ||||
-rw-r--r-- | script/core/completion.lua | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/script/config/config.lua b/script/config/config.lua index bfcfa572..91f0a00b 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -181,7 +181,7 @@ local Template = { ['Lua.completion.keywordSnippet'] = Type.String >> 'Replace', ['Lua.completion.displayContext'] = Type.Integer >> 6, ['Lua.completion.workspaceWord'] = Type.Boolean >> true, - ['Lua.completion.word'] = Type.Boolean >> true, + ['Lua.completion.showWord'] = Type.String >> 'Enable', ['Lua.completion.autoRequire'] = Type.Boolean >> true, ['Lua.completion.showParams'] = Type.Boolean >> true, ['Lua.signatureHelp.enable'] = Type.Boolean >> true, diff --git a/script/core/completion.lua b/script/core/completion.lua index 6914e9cf..0d837b08 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -624,11 +624,14 @@ local function checkTableField(ast, word, start, results) end local function checkCommon(myUri, word, text, offset, results) - if not config.get 'Lua.completion.word' then + local showWord = config.get 'Lua.completion.showWord' + if showWord == 'Disable' then return end - results.enableCommon = true + if showWord == 'Fallback' and #results ~= 0 then + return + end local used = {} for _, result in ipairs(results) do used[result.label:match '^[^(]*'] = true |