summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-05 20:17:49 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-05 20:17:49 +0800
commitbab7c96347957948d59a85ebb3e3288c8273e3bb (patch)
tree57fdd92c47434966648cc943f2db63606ec128e1 /script
parent0353900ee3a41d3e92d3645bddb4d46ea60c7c3f (diff)
downloadlua-language-server-bab7c96347957948d59a85ebb3e3288c8273e3bb.zip
accept commit characters
Diffstat (limited to 'script')
-rw-r--r--script/core/completion.lua1
-rw-r--r--script/proto/define.lua7
-rw-r--r--script/provider/provider.lua1
3 files changed, 8 insertions, 1 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index c4784322..bac4f673 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -384,6 +384,7 @@ local function checkModule(ast, word, offset, results)
results[#results+1] = {
label = stemName,
kind = define.CompletionItemKind.Variable,
+ commitCharacters = {'.'},
id = stack(function ()
return {
detail = buildDetail(targetSource),
diff --git a/script/proto/define.lua b/script/proto/define.lua
index 1425395a..082e382a 100644
--- a/script/proto/define.lua
+++ b/script/proto/define.lua
@@ -49,7 +49,7 @@ function m.position(lines, text, offset)
if start < 1 then
start = 1
end
- if col <= finish then
+ if col <= finish - start + 1 then
local ucol = util.utf8Len(text, start, start + col - 1)
if row < 1 then
row = 1
@@ -58,6 +58,11 @@ function m.position(lines, text, offset)
line = row - 1,
character = ucol,
}
+ elseif col == 1 then
+ return {
+ line = row - 1,
+ character = 0,
+ }
else
return {
line = row,
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 3bd82b1c..67f07a9f 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -372,6 +372,7 @@ proto.on('textDocument/completion', function (params)
sortText = ('%04d'):format(i),
insertText = res.insertText,
insertTextFormat = res.insertTextFormat,
+ commitCharacters = res.commitCharacters,
textEdit = res.textEdit and {
range = define.range(
lines,