From c7137ba14af910490a523d50c001098946ddf410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 14 Nov 2019 11:41:47 +0800 Subject: =?UTF-8?q?=E5=A4=9A=E8=A1=8C=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=8A=98=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/folding_range.lua | 7 +++++++ server/src/method/textDocument/foldingRange.lua | 3 +++ 2 files changed, 10 insertions(+) diff --git a/server/src/core/folding_range.lua b/server/src/core/folding_range.lua index db0b0bdf..e94d1ffe 100644 --- a/server/src/core/folding_range.lua +++ b/server/src/core/folding_range.lua @@ -8,6 +8,7 @@ local foldingType = { ['while'] = {'region', 'end', }, ['repeat'] = {'region', 'until',}, ['table'] = {'region', '}', }, + ['string'] = {'regtion', ']', }, } return function (vm, comments) @@ -42,6 +43,12 @@ return function (vm, comments) kind = data[1], } end + elseif tp == 'string' then + result[#result+1] = { + start = start, + finish = finish, + kind = data[1], + } elseif data[1] == 'region' then result[#result+1] = { start = start, diff --git a/server/src/method/textDocument/foldingRange.lua b/server/src/method/textDocument/foldingRange.lua index 33346285..0320b422 100644 --- a/server/src/method/textDocument/foldingRange.lua +++ b/server/src/method/textDocument/foldingRange.lua @@ -10,6 +10,9 @@ local function convertRange(lines, range) endLine = finish_row - 2, kind = range.kind, } + if result.startLine >= result.endLine then + return nil + end return result end -- cgit v1.2.3