summaryrefslogtreecommitdiff
path: root/script/capability/completion.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-20 21:55:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-20 21:55:41 +0800
commitc63b2e404d8d2bb984afe3678a5ba2b2836380cc (patch)
treea70661effacc7a29caa8d49583673ac4be2faaf5 /script/capability/completion.lua
parent85c5a4210e4447422cd5677369ae740ed65725a0 (diff)
downloadlua-language-server-c63b2e404d8d2bb984afe3678a5ba2b2836380cc.zip
remove the old version
Diffstat (limited to 'script/capability/completion.lua')
-rw-r--r--script/capability/completion.lua68
1 files changed, 0 insertions, 68 deletions
diff --git a/script/capability/completion.lua b/script/capability/completion.lua
deleted file mode 100644
index e302f30d..00000000
--- a/script/capability/completion.lua
+++ /dev/null
@@ -1,68 +0,0 @@
-local rpc = require 'rpc'
-local nonil = require 'without-check-nil'
-
-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(lsp)
- if isEnable then
- return
- end
-
- nonil.enable()
- if not lsp.client.capabilities.textDocument.completion.dynamicRegistration then
- return
- end
- nonil.disable()
-
- isEnable = true
- log.debug('Enable completion.')
- rpc:request('client/registerCapability', {
- registrations = {
- {
- id = 'completion',
- method = 'textDocument/completion',
- registerOptions = {
- resolveProvider = true,
- triggerCharacters = allWords(),
- },
- },
- }
- })
-end
-
-local function disable(lsp)
- if not isEnable then
- return
- end
-
- nonil.enable()
- if not lsp.client.capabilities.textDocument.completion.dynamicRegistration then
- return
- end
- nonil.disable()
-
- isEnable = false
- log.debug('Disable completion.')
- rpc:request('client/unregisterCapability', {
- unregisterations = {
- {
- id = 'completion',
- method = 'textDocument/completion',
- },
- }
- })
-end
-
-return {
- enable = enable,
- disable = disable,
-}