summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-20 14:23:09 +0800
committerGitHub <noreply@github.com>2021-08-20 14:23:09 +0800
commit54e6511392c291e8d6e90d199b5117b2cc015855 (patch)
treefa097c8ceee443fad150b4c6e8a72c34fb87d1fe /script
parente13158e0ad2412358fa186a7292460a4a0602e1f (diff)
parent0ae22219224227d756b956b9988b55e9ec66fed6 (diff)
downloadlua-language-server-54e6511392c291e8d6e90d199b5117b2cc015855.zip
Merge pull request #654 from natecraddock/text-completion
Lua.completion.word configuration option
Diffstat (limited to 'script')
-rw-r--r--script/config/config.lua1
-rw-r--r--script/core/completion.lua7
2 files changed, 8 insertions, 0 deletions
diff --git a/script/config/config.lua b/script/config/config.lua
index 9d3f8085..91f0a00b 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.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 c5a375f5..06219e74 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -624,7 +624,14 @@ local function checkTableField(ast, word, start, results)
end
local function checkCommon(myUri, word, text, offset, results)
+ 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