summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-14 11:41:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-14 11:41:47 +0800
commitc7137ba14af910490a523d50c001098946ddf410 (patch)
tree489137fb25ec9c0dc39ab679ecd1d6d4c074bd6a
parent6b51351ecf215a09609e63a17209ac8757cc3844 (diff)
downloadlua-language-server-c7137ba14af910490a523d50c001098946ddf410.zip
多行字符串支持折行
-rw-r--r--server/src/core/folding_range.lua7
-rw-r--r--server/src/method/textDocument/foldingRange.lua3
2 files changed, 10 insertions, 0 deletions
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