diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-02-19 16:16:59 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-02-19 16:16:59 +0800 |
commit | bed0c4911969b521fa3c15158df273c7e6106882 (patch) | |
tree | 027d3c032c4c2d210d015fe8bc45c4133ac925b3 | |
parent | 9ab7ed96dbb2218199a0370872146fe5c1fa14e1 (diff) | |
download | lua-language-server-bed0c4911969b521fa3c15158df273c7e6106882.zip |
continuous completion handles `textEdit.finish`
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/core/completion.lua | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md index e509505e..612dadde 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ * `CHG` rename `table*` to `tablelib` * `FIX` missed syntax error `f() = 1` * `FIX` missed global `bit` in `LuaJIT` +* `FIX` completion: may insert error text when continuous inputing * `FIX` [#349](https://github.com/sumneko/lua-language-server/issues/349) ## 1.15.1 diff --git a/script/core/completion.lua b/script/core/completion.lua index a8500b09..8b1cbcf2 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -1709,6 +1709,7 @@ local function makeCache(uri, offset, results) cache.results = results cache.offset = offset cache.word = word:lower() + cache.length = #word end local function getCache(uri, offset) @@ -1725,6 +1726,14 @@ local function getCache(uri, offset) return nil end + local ext = #word - cache.length + cache.length = #word + for _, result in ipairs(cache.results) do + if result.textEdit then + result.textEdit.finish = result.textEdit.finish + ext + end + end + if cache.results.enableCommon then local results = cache.results for i = #results, 1, -1 do |