summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/config.lua1
-rw-r--r--script/method/completionItem/resolve.lua8
2 files changed, 8 insertions, 1 deletions
diff --git a/script/config.lua b/script/config.lua
index 4c83e511..51f090fe 100644
--- a/script/config.lua
+++ b/script/config.lua
@@ -123,6 +123,7 @@ local ConfigTemplate = {
enable = {true, Boolean},
callSnippet = {'Disable', String},
keywordSnippet = {'Replace', String},
+ displayContext = {6, Integer},
},
signatureHelp = {
enable = {true, Boolean},
diff --git a/script/method/completionItem/resolve.lua b/script/method/completionItem/resolve.lua
index 7d18288e..0e55d311 100644
--- a/script/method/completionItem/resolve.lua
+++ b/script/method/completionItem/resolve.lua
@@ -1,4 +1,10 @@
+local config = require 'config'
+
return function (lsp, item)
+ local context = config.config.completion.displayContext
+ if context <= 0 then
+ return item
+ end
if not item.data then
return item
end
@@ -10,7 +16,7 @@ return function (lsp, item)
end
local row = lines:rowcol(offset)
local firstRow = lines[row]
- local lastRow = lines[math.min(row + 5, #lines)]
+ local lastRow = lines[math.min(row + context - 1, #lines)]
local snip = text:sub(firstRow.start, lastRow.finish)
local document = ([[
%s