summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-02-19 17:43:34 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-02-19 17:43:34 +0800
commit71244c2644abc5b4ecc9d3296f9bed99d4bee888 (patch)
treec2dc97ae119f014dc0e65c33213672b5b63c4858 /script/provider
parentbed0c4911969b521fa3c15158df273c7e6106882 (diff)
downloadlua-language-server-71244c2644abc5b4ecc9d3296f9bed99d4bee888.zip
close #384 completion supports interface
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/capability.lua20
-rw-r--r--script/provider/completion.lua9
2 files changed, 11 insertions, 18 deletions
diff --git a/script/provider/capability.lua b/script/provider/capability.lua
index 79261129..a87dea20 100644
--- a/script/provider/capability.lua
+++ b/script/provider/capability.lua
@@ -1,19 +1,11 @@
-local sp = require 'bee.subprocess'
-local nonil = require 'without-check-nil'
-local client = require 'provider.client'
-local platform = require 'bee.platform'
+local sp = require 'bee.subprocess'
+local nonil = require 'without-check-nil'
+local client = require 'provider.client'
+local platform = require 'bee.platform'
+local completion = require 'provider.completion'
local m = {}
-local function allWords()
- local str = [[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:('"[,#*@|=- ]]
- local list = {}
- for c in str:gmatch '.' do
- list[#list+1] = c
- end
- return list
-end
-
local function testFileEvents(initer)
initer.fileOperations = {
didCreate = {
@@ -102,7 +94,7 @@ function m.getIniter()
if not client.info.capabilities.textDocument.completion.dynamicRegistration then
initer.completionProvider = {
resolveProvider = true,
- triggerCharacters = allWords(),
+ triggerCharacters = completion.allWords(),
}
end
nonil.disable()
diff --git a/script/provider/completion.lua b/script/provider/completion.lua
index 67d1771e..2dc92569 100644
--- a/script/provider/completion.lua
+++ b/script/provider/completion.lua
@@ -3,8 +3,8 @@ local proto = require 'proto'
local isEnable = false
local function allWords()
- local str = [[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:('"[,#*@|=- ]]
- local list = {}
+ local str = [[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:('"[,#*@|=-{ ]]
+ local list = {'\n', '\t'}
for c in str:gmatch '.' do
list[#list+1] = c
end
@@ -48,6 +48,7 @@ local function disable()
end
return {
- enable = enable,
- disable = disable,
+ enable = enable,
+ disable = disable,
+ allWords = allWords,
}