Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit cd5f60e

Browse files
committed
fixed foldings broken on commented quotes
1 parent 75a6257 commit cd5f60e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

UI/Components/EditorElement/Foldings/EditorFoldingStrategy.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ namespace SPCode.UI.Components
66
{
77
public class SPFoldingStrategy
88
{
9-
public char OpeningBrace { get; set; }
10-
public char ClosingBrace { get; set; }
11-
129
public SPFoldingStrategy()
1310
{
14-
OpeningBrace = '{';
15-
ClosingBrace = '}';
11+
1612
}
1713

1814
public void UpdateFoldings(FoldingManager manager, TextDocument document)
@@ -36,6 +32,7 @@ public IEnumerable<NewFolding> CreateNewFoldings(ITextSource document)
3632
for (var i = 0; i < document.TextLength; ++i)
3733
{
3834
var c = document.GetCharAt(i);
35+
3936
if (c == '\n' || c == '\r')
4037
{
4138
lastNewLineOffset = i + 1;
@@ -120,15 +117,15 @@ public IEnumerable<NewFolding> CreateNewFoldings(ITextSource document)
120117
}
121118
case 3:
122119
{
123-
if (c == '\"')
120+
if (c == '\"' && document.GetCharAt(i - 1) != '\\')
124121
{
125122
CommentMode = 0;
126123
}
127124
break;
128125
}
129126
case 4:
130127
{
131-
if (c == '\'')
128+
if (c == '\'' && document.GetCharAt(i - 1) != '\\')
132129
{
133130
CommentMode = 0;
134131
}

0 commit comments

Comments
 (0)