aboutsummaryrefslogtreecommitdiff
path: root/internal/lsp/source/folding_range.go
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2022-03-29 00:50:59 -0700
committerDan Willemsen <dwillemsen@google.com>2022-03-29 00:52:27 -0700
commitf10932f763d058b0dcb3acfb795c869996fef47b (patch)
tree7e04d345c214f3efac3c4b86c7ec3e831c500437 /internal/lsp/source/folding_range.go
parentd6d1ab63f7e2d16fb9a1f1d29755d12da90aa0bb (diff)
parente693fb417253d14786976bd29a456961aa8b6343 (diff)
downloadgolang-x-tools-f10932f763d058b0dcb3acfb795c869996fef47b.tar.gz
Merge commit 'e693fb417253d14786976bd29a456961aa8b6343'
Change-Id: I65e50880732e718fa2264e47ef7cc19e37cc2f05
Diffstat (limited to 'internal/lsp/source/folding_range.go')
-rw-r--r--internal/lsp/source/folding_range.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/lsp/source/folding_range.go b/internal/lsp/source/folding_range.go
index be3f4b0c3..576308f99 100644
--- a/internal/lsp/source/folding_range.go
+++ b/internal/lsp/source/folding_range.go
@@ -106,6 +106,11 @@ func foldingRangeFunc(fset *token.FileSet, m *protocol.ColumnMapper, n ast.Node,
startSpecs, endSpecs = n.Specs[0].Pos(), n.Specs[num-1].End()
}
start, end = validLineFoldingRange(fset, n.Lparen, n.Rparen, startSpecs, endSpecs, lineFoldingOnly)
+ case *ast.BasicLit:
+ // Fold raw string literals from position of "`" to position of "`".
+ if n.Kind == token.STRING && len(n.Value) >= 2 && n.Value[0] == '`' && n.Value[len(n.Value)-1] == '`' {
+ start, end = n.Pos(), n.End()
+ }
case *ast.CompositeLit:
// Fold between positions of or lines between "{" and "}".
var startElts, endElts token.Pos