summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorNathan Craddock <nzcraddock@gmail.com>2021-08-18 13:50:22 -0600
committerNathan Craddock <nzcraddock@gmail.com>2021-08-18 13:50:22 -0600
commit822e794883b41bf5e8758cce5d4601a69f3ee874 (patch)
treeed23bf08c58d9497ab60bca41486d38449cabfe1 /script
parent907bbbe0925e49f7b347cb81c20159f20dd98854 (diff)
downloadlua-language-server-822e794883b41bf5e8758cce5d4601a69f3ee874.zip
Lua.completion.word configuration option
Adds an option to entirely disable word completions. More specifically, this disables CompletionItemKind.Text, but I used "word" to align with the existing workspaceWord configuration option.
Diffstat (limited to 'script')
-rw-r--r--script/config/config.lua1
-rw-r--r--script/core/completion.lua4
2 files changed, 5 insertions, 0 deletions
diff --git a/script/config/config.lua b/script/config/config.lua
index 9d3f8085..bfcfa572 100644
--- a/script/config/config.lua
+++ b/script/config/config.lua
@@ -181,6 +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.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 d4f77368..6914e9cf 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -624,6 +624,10 @@ local function checkTableField(ast, word, start, results)
end
local function checkCommon(myUri, word, text, offset, results)
+ if not config.get 'Lua.completion.word' then
+ return
+ end
+
results.enableCommon = true
local used = {}
for _, result in ipairs(results) do