From afd1c79dfd0efbcc0cb34465fb9a3e07fde7c01d Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Wed, 11 Apr 2012 15:53:46 +0400 Subject: [PATCH] Changed "Valid string template" highlighting to simply "String highlighting". --- .../jet/plugin/highlighter/JetColorSettingsPage.java | 4 ++-- .../jetbrains/jet/plugin/highlighter/JetHighlighter.java | 8 ++++---- .../jet/plugin/highlighter/JetHighlightingColors.java | 6 +++--- .../jetbrains/jet/plugin/highlighter/JetPsiChecker.java | 4 +++- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java index f7f9cc2fdc4..8ddad2c864e 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java @@ -58,7 +58,7 @@ public class JetColorSettingsPage implements ColorSettingsPage { "[Deprecated]\n" + "public class MyClass<out T : Iterable<T>>(var prop1 : Int) {\n" + " fun foo(nullable : String?, r : Runnable, f : () -> Int) {\n" + - " println(\"length\\nis ${nullable?.length} \\e\")\n" + + " println(\"length\\nis ${nullable?.length} \\e\")\n" + " val ints = java.util.ArrayList(2)\n" + " ints[0] = 102 + f()\n" + " val myFun = { -> \"\" }\n" + @@ -107,7 +107,7 @@ public class JetColorSettingsPage implements ColorSettingsPage { new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.number"), JetHighlightingColors.NUMBER), new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.string"), JetHighlightingColors.STRING), - new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.string.escape"), JetHighlightingColors.VALID_STRING_ESCAPE), + new AttributesDescriptor(JetBundle.message("options.jet.attribute.descriptor.string.escape"), JetHighlightingColors.STRING_ESCAPE), new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.invalid.escape.in.string"), JetHighlightingColors.INVALID_STRING_ESCAPE), new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.operator.sign"), JetHighlightingColors.OPERATOR_SIGN), diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlighter.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlighter.java index 77f52f5ff7c..fbd81220c7b 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlighter.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlighter.java @@ -73,11 +73,11 @@ public class JetHighlighter extends SyntaxHighlighterBase { keys.put(JetTokens.OPEN_QUOTE, JetHighlightingColors.STRING); keys.put(JetTokens.CLOSING_QUOTE, JetHighlightingColors.STRING); keys.put(JetTokens.REGULAR_STRING_PART, JetHighlightingColors.STRING); - keys.put(JetTokens.LONG_TEMPLATE_ENTRY_END, JetHighlightingColors.VALID_STRING_ESCAPE); - keys.put(JetTokens.LONG_TEMPLATE_ENTRY_START, JetHighlightingColors.VALID_STRING_ESCAPE); - keys.put(JetTokens.SHORT_TEMPLATE_ENTRY_START, JetHighlightingColors.VALID_STRING_ESCAPE); + keys.put(JetTokens.LONG_TEMPLATE_ENTRY_END, JetHighlightingColors.STRING_ESCAPE); + keys.put(JetTokens.LONG_TEMPLATE_ENTRY_START, JetHighlightingColors.STRING_ESCAPE); + keys.put(JetTokens.SHORT_TEMPLATE_ENTRY_START, JetHighlightingColors.STRING_ESCAPE); - keys.put(JetTokens.ESCAPE_SEQUENCE, JetHighlightingColors.VALID_STRING_ESCAPE); + keys.put(JetTokens.ESCAPE_SEQUENCE, JetHighlightingColors.STRING_ESCAPE); keys.put(JetTokens.CHARACTER_LITERAL, JetHighlightingColors.STRING); diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java index 383e8184a8c..3b4ca3e9d0e 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java @@ -46,14 +46,14 @@ public class JetHighlightingColors { SyntaxHighlighterColors.STRING.getDefaultAttributes() ); - public static final TextAttributesKey VALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey( - "KOTLIN_VALID_STRING_ESCAPE", + public static final TextAttributesKey STRING_ESCAPE = TextAttributesKey.createTextAttributesKey( + "KOTLIN_STRING_ESCAPE", SyntaxHighlighterColors.VALID_STRING_ESCAPE.getDefaultAttributes() ); public static final TextAttributesKey INVALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey( "KOTLIN_INVALID_STRING_ESCAPE", - SyntaxHighlighterColors.INVALID_STRING_ESCAPE.getDefaultAttributes() + new TextAttributes(null, HighlighterColors.BAD_CHARACTER.getDefaultAttributes().getBackgroundColor(), Color.RED, EffectType.WAVE_UNDERSCORE, 0) ); public static final TextAttributesKey OPERATOR_SIGN = TextAttributesKey.createTextAttributesKey( diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java index 24f14ae7c85..b44a532d3c7 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java @@ -172,9 +172,11 @@ public class JetPsiChecker implements Annotator { if (diagnostic.getFactory() == Errors.ILLEGAL_ESCAPE_SEQUENCE) { for (TextRange textRange : diagnostic.getTextRanges()) { - Annotation annotation = holder.createErrorAnnotation(textRange, diagnostic.getMessage()); + Annotation annotation = holder.createErrorAnnotation(textRange, getMessage(diagnostic)); annotation.setTextAttributes(JetHighlightingColors.INVALID_STRING_ESCAPE); + //annotation.setEnforcedTextAttributes(TextAttributes.merge(JetHighlightingColors.INVALID_STRING_ESCAPE.getDefaultAttributes(), annotation.getTextAttributes().getDefaultAttributes())); } + return; } if (diagnostic instanceof RedeclarationDiagnostic) {