diff --git a/script/config/config.lua b/script/config/config.lua index bfcfa5727d5701672ba7459b47794e57537e5fe3..91f0a00b88f026c2239cc9f99d78cd06b33dd233 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 6914e9cf457bf080377c3e8743be63afd0e84fb4..0d837b08d9d75057168a10c0931a0fcd09469ea0 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