diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-05 14:42:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-05 14:42:13 +0800 |
commit | 977efc2804c840456edeac2af95ccf68f815d88e (patch) | |
tree | 4b743e160a92e7386ad089084e0ff97099a9bb5d /script/method | |
parent | f3377e1a6bf0cb0d99a44790613ac10c774579b5 (diff) | |
download | lua-language-server-977efc2804c840456edeac2af95ccf68f815d88e.zip |
#202 增加一个设置可以调整显示建议相关代码片段
Diffstat (limited to 'script/method')
-rw-r--r-- | script/method/completionItem/resolve.lua | 8 |
1 files changed, 7 insertions, 1 deletions
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 |