summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md1
-rw-r--r--script/config.lua1
-rw-r--r--script/core/completion.lua3
3 files changed, 5 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md
index 25ec001f..a4e2da3a 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,7 @@
## 1.20.5
`CHG` folding: supports `-- #region`
+`CHG` completion: `auto require` can be disabled
`FIX` [#522](https://github.com/sumneko/lua-language-server/issues/522)
`FIX` [#523](https://github.com/sumneko/lua-language-server/issues/523)
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