Skip to content

Commit 0615d1a

Browse files
committed
Изменена регулярка
1 parent 355280c commit 0615d1a

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TabAlignmentDiagnostic.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
)
4242
public class TabAlignmentDiagnostic extends AbstractDiagnostic {
4343

44-
private static final Pattern pattern = Pattern.compile("\\S[\\S ]*(\\t+)(?!(\\/\\/|$))");
44+
private static final Pattern pattern = Pattern.compile("\\S[\\S ]*(\\t+)(?! *//)");
4545

4646
@Override
4747
public void check() {
@@ -54,7 +54,7 @@ public void check() {
5454
continue;
5555
}
5656

57-
Matcher matcher = pattern.matcher(lines[i]);
57+
Matcher matcher = pattern.matcher(lines[i].stripTrailing());
5858
if (matcher.find()) {
5959
diagnosticStorage.addDiagnostic(i, matcher.start(1), i, matcher.end(1));
6060
}

src/test/resources/diagnostics/TabAlignmentDiagnostic.bsl

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
foo = f;
33
foo = foo;
44
foo = foo;
5-
foo = foo;
6-
foo = foo;
5+
foo = foo;
6+
foo = foo;
77

88
// в мультилайне можно
99
F = ";
10-
| foo ";
10+
| foo ";
1111

12-
// foo = foo; // в комментах можно
12+
// foo = foo; // в комментах можно
1313

14-
ТипСообщения = "CSA" // перед комментами можно
14+
ТипСообщения = "CSA" // перед комментами можно
1515
// в конце строки можно
16-
f = f;
16+
f = f;
17+

0 commit comments

Comments
 (0)