diff options
-rw-r--r-- | script/core/completion.lua | 1 | ||||
-rw-r--r-- | script/proto/define.lua | 7 | ||||
-rw-r--r-- | script/provider/provider.lua | 1 |
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, |