summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-02 18:14:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-02 18:14:54 +0800
commit55e7d5950398eb6816646d1612701565364fa08b (patch)
tree201c39c10848958d6acd3b6f4469082b691fef70 /script/provider
parent913aced8f27185e1f078b64e4d3c147e73589165 (diff)
downloadlua-language-server-55e7d5950398eb6816646d1612701565364fa08b.zip
resolve #461
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/provider.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index f8592d0c..59af1c7a 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -41,6 +41,10 @@ local function updateConfig()
scopeUri = workspace.uri,
section = 'editor.semanticHighlighting.enabled',
},
+ {
+ scopeUri = workspace.uri,
+ section = 'editor.acceptSuggestionOnEnter',
+ },
},
})
if not configs or not configs[1] then
@@ -50,9 +54,10 @@ local function updateConfig()
local updated = configs[1]
local other = {
- associations = configs[2],
- exclude = configs[3],
- semantic = configs[4],
+ associations = configs[2],
+ exclude = configs[3],
+ semantic = configs[4],
+ acceptSuggestionOnEnter = configs[5],
}
local oldConfig = util.deepCopy(config.config)
@@ -443,6 +448,13 @@ proto.on('textDocument/completion', function (params)
if not files.exists(uri) then
return nil
end
+ if config.other.acceptSuggestionOnEnter ~= 'off' then
+ if params.context.triggerCharacter == '\n'
+ or params.context.triggerCharacter == '{'
+ or params.context.triggerCharacter == ',' then
+ return
+ end
+ end
await.setPriority(1000)
local clock = os.clock()
local offset = files.offset(uri, params.position)