diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 21:57:09 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 21:57:09 +0800 |
commit | 4ca61ec457822dd14966afa0752340ae8ce180a1 (patch) | |
tree | ae8adb1ad82c717868e551e699fd3cf3bb290089 /script-beta/provider/completion.lua | |
parent | c63b2e404d8d2bb984afe3678a5ba2b2836380cc (diff) | |
download | lua-language-server-4ca61ec457822dd14966afa0752340ae8ce180a1.zip |
no longer beta
Diffstat (limited to 'script-beta/provider/completion.lua')
-rw-r--r-- | script-beta/provider/completion.lua | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/script-beta/provider/completion.lua b/script-beta/provider/completion.lua deleted file mode 100644 index e506cd7b..00000000 --- a/script-beta/provider/completion.lua +++ /dev/null @@ -1,54 +0,0 @@ -local proto = require 'proto' - -local isEnable = false - -local function allWords() - local str = [[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:('"[,#*@| ]] - local list = {} - for c in str:gmatch '.' do - list[#list+1] = c - end - return list -end - -local function enable() - -- TODO 检查客户端是否支持动态注册自动完成 - if isEnable then - return - end - isEnable = true - log.debug('Enable completion.') - proto.awaitRequest('client/registerCapability', { - registrations = { - { - id = 'completion', - method = 'textDocument/completion', - registerOptions = { - resolveProvider = true, - triggerCharacters = allWords(), - }, - }, - } - }) -end - -local function disable() - if not isEnable then - return - end - isEnable = false - log.debug('Disable completion.') - proto.awaitRequest('client/unregisterCapability', { - unregisterations = { - { - id = 'completion', - method = 'textDocument/completion', - }, - } - }) -end - -return { - enable = enable, - disable = disable, -} |