From 977efc2804c840456edeac2af95ccf68f815d88e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 5 Aug 2020 14:42:13 +0800 Subject: =?UTF-8?q?#202=20=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=8F=AF=E4=BB=A5=E8=B0=83=E6=95=B4=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BB=BA=E8=AE=AE=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81=E7=89=87?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/config.lua | 1 + script/method/completionItem/resolve.lua | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'script') 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 -- cgit v1.2.3