diff --git a/src/org/intellij/erlang/inspection/ErlangTripleQuotasSyntaxInspection.java b/src/org/intellij/erlang/inspection/ErlangTripleQuotasSyntaxInspection.java
index b0f486fb6..045d4db3e 100644
--- a/src/org/intellij/erlang/inspection/ErlangTripleQuotasSyntaxInspection.java
+++ b/src/org/intellij/erlang/inspection/ErlangTripleQuotasSyntaxInspection.java
@@ -22,7 +22,12 @@
import org.intellij.erlang.psi.ErlangVisitor;
import org.jetbrains.annotations.NotNull;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
public class ErlangTripleQuotasSyntaxInspection extends ErlangInspectionBase {
+ private static final Pattern PATTERN = Pattern.compile("\\n\\s*\"\"\"$");
+
@Override
protected @NotNull ErlangVisitor buildErlangVisitor(@NotNull ProblemsHolder holder,
@NotNull LocalInspectionToolSession session) {
@@ -33,7 +38,15 @@ public void visitStringLiteral(@NotNull ErlangStringLiteral o) {
if (text.startsWith("\"\"\"") && !text.startsWith("\"\"\"\n")) {
holder.registerProblem(o, "Not white space after start of triple-quoted string");
}
+ if (text.endsWith("\"\"\"") && !endsWithPattern(text)) {
+ holder.registerProblem(o, "Bad indentation in triple-quoted string");
+ }
}
};
}
+
+ private static boolean endsWithPattern(String tripleQuotedString) {
+ Matcher matcher = PATTERN.matcher(tripleQuotedString);
+ return matcher.find();
+ }
}
diff --git a/testData/highlighting/Erlang27SyntaxNoError.erl b/testData/highlighting/Erlang27SyntaxNoError.erl
index 7f7fbfe50..ac5a782ea 100644
--- a/testData/highlighting/Erlang27SyntaxNoError.erl
+++ b/testData/highlighting/Erlang27SyntaxNoError.erl
@@ -1,4 +1,4 @@
--export([quotes/0, single_line/0]).
+-export([quotes/0, single_line/0, bad_indent/0]).
quotes() ->
"""
@@ -9,3 +9,7 @@ quotes() ->
single_line() ->
"""main""",
ok.
+
+bad_indent() ->
+ """
+ main""".
\ No newline at end of file