summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-30 14:43:16 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-30 14:43:16 +0800
commit69a3ce64e5032f036d054ae435a8c523996567ed (patch)
tree34a603c3974fc5b8874ad2f9dc59768e4bc2f574 /script
parentdf40bf8e2c77ad38a0b98b95541f86656b2d8f0f (diff)
downloadlua-language-server-69a3ce64e5032f036d054ae435a8c523996567ed.zip
resolve #514
Diffstat (limited to 'script')
-rw-r--r--script/config.lua1
-rw-r--r--script/core/completion.lua3
2 files changed, 4 insertions, 0 deletions
diff --git a/script/config.lua b/script/config.lua
index 7991e1ad..a133cf1c 100644
--- a/script/config.lua
+++ b/script/config.lua
@@ -164,6 +164,7 @@ local ConfigTemplate = {
keywordSnippet = {'Replace', String},
displayContext = {6, Integer},
workspaceWord = {true, Boolean},
+ autoRequire = {true, Boolean},
},
signatureHelp = {
enable = {true, Boolean},
diff --git a/script/core/completion.lua b/script/core/completion.lua
index 59bba005..6ee4d61d 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -292,6 +292,9 @@ local function checkLocal(ast, word, offset, results)
end
local function checkModule(ast, word, offset, results)
+ if not config.config.completion.autoRequire then
+ return
+ end
local locals = guide.getVisibleLocals(ast.ast, offset)
for uri in files.eachFile() do
if files.eq(uri, guide.getUri(ast.ast)) then