summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkevinhwang91 <kevin.hwang@live.com>2022-04-05 20:01:09 +0800
committerkevinhwang91 <kevin.hwang@live.com>2022-04-05 20:01:09 +0800
commit64d5df99c453ffe90cdeb0003f92bd9b632700d7 (patch)
tree4fa9e0825ce2f45f8167def041292e4146ff5006
parent02e76eeb7c12454da8e6d961510164becfe4f2c3 (diff)
downloadlua-language-server-64d5df99c453ffe90cdeb0003f92bd9b632700d7.zip
fix(completion): limit extra lines
-rw-r--r--script/core/completion/completion.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index cf794433..06b46de9 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -219,7 +219,7 @@ local function getSnip(source)
goto CONTINUE
end
local firstRow = guide.rowColOf(def.start)
- local lastRow = firstRow + context
+ local lastRow = math.min(guide.rowColOf(def.finish) + 1, firstRow + context)
local lastOffset = lines[lastRow] and (lines[lastRow] - 1) or #text
local snip = text:sub(lines[firstRow], lastOffset)
return snip