summaryrefslogtreecommitdiff
path: root/script/provider/completion.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-02 18:30:13 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-02 18:30:13 +0800
commite5947d5cb525d0c3376d36be657c0f940d8bfaf8 (patch)
tree7457fbc168b3f0598038fe299b57c4e98b8400e9 /script/provider/completion.lua
parent55e7d5950398eb6816646d1612701565364fa08b (diff)
downloadlua-language-server-e5947d5cb525d0c3376d36be657c0f940d8bfaf8.zip
fix #482
Diffstat (limited to 'script/provider/completion.lua')
-rw-r--r--script/provider/completion.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/script/provider/completion.lua b/script/provider/completion.lua
index 9cf3a39a..1adcc47a 100644
--- a/script/provider/completion.lua
+++ b/script/provider/completion.lua
@@ -1,4 +1,6 @@
-local proto = require 'proto'
+local proto = require 'proto'
+local nonil = require 'without-check-nil'
+local client = require 'provider.client'
local isEnable = false
@@ -15,6 +17,11 @@ local function enable()
if isEnable then
return
end
+ nonil.enable()
+ if not client.info.capabilities.textDocument.completion.dynamicRegistration then
+ return
+ end
+ nonil.disable()
isEnable = true
log.debug('Enable completion.')
proto.awaitRequest('client/registerCapability', {
@@ -35,6 +42,11 @@ local function disable()
if not isEnable then
return
end
+ nonil.enable()
+ if not client.info.capabilities.textDocument.completion.dynamicRegistration then
+ return
+ end
+ nonil.disable()
isEnable = false
log.debug('Disable completion.')
proto.awaitRequest('client/unregisterCapability', {