From a4bee5779085c2e836d4203af832a609fc857adc Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 10 Dec 2010 19:09:41 +0300 Subject: [PATCH] list all colors and provide full preview in regexp color settings page; remove color which is very unlikely to be usefully highlighted --- .../lang/regexp/RegExpColorsPage.java | 20 ++++++++++++------- .../lang/regexp/RegExpHighlighter.java | 5 ----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpColorsPage.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpColorsPage.java index 8afcb738c59e..1c175c978094 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpColorsPage.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpColorsPage.java @@ -15,7 +15,6 @@ */ package org.intellij.lang.regexp; -import com.intellij.application.options.colors.InspectionColorSettingsPage; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.fileTypes.SyntaxHighlighter; import com.intellij.openapi.options.colors.AttributesDescriptor; @@ -31,13 +30,20 @@ import java.util.Map; /** * @author traff */ -public class RegExpColorsPage implements ColorSettingsPage, InspectionColorSettingsPage { +public class RegExpColorsPage implements ColorSettingsPage { private static final AttributesDescriptor[] ATTRS = new AttributesDescriptor[] { - new AttributesDescriptor("Keywords", RegExpHighlighter.META), - new AttributesDescriptor("Escaped characters", RegExpHighlighter.ESC_CHARACTER), - new AttributesDescriptor("Braces", RegExpHighlighter.BRACES), - new AttributesDescriptor("Brackets", RegExpHighlighter.BRACKETS), + new AttributesDescriptor("Keyword", RegExpHighlighter.META), + new AttributesDescriptor("Escaped character", RegExpHighlighter.ESC_CHARACTER), + new AttributesDescriptor("Invalid escape sequence", RegExpHighlighter.INVALID_CHARACTER_ESCAPE), + new AttributesDescriptor("Redundant escape sequence", RegExpHighlighter.REDUNDANT_ESCAPE), + new AttributesDescriptor("Brace", RegExpHighlighter.BRACES), + new AttributesDescriptor("Bracket", RegExpHighlighter.BRACKETS), new AttributesDescriptor("Parenthesis", RegExpHighlighter.PARENTHS), + new AttributesDescriptor("Comma", RegExpHighlighter.COMMA), + new AttributesDescriptor("Bad character", RegExpHighlighter.BAD_CHARACTER), + new AttributesDescriptor("Character class", RegExpHighlighter.CHAR_CLASS), + new AttributesDescriptor("Quote character", RegExpHighlighter.QUOTE_CHARACTER), + new AttributesDescriptor("Comment", RegExpHighlighter.COMMENT) }; @NonNls private static final HashMap ourTagToDescriptorMap = new HashMap(); @@ -71,7 +77,7 @@ public class RegExpColorsPage implements ColorSettingsPage, InspectionColorSetti @NotNull public String getDemoText() { return - "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$"; + "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}\\x0g\\#\\p{alpha}\\Q\\E$"; } diff --git a/RegExpSupport/src/org/intellij/lang/regexp/RegExpHighlighter.java b/RegExpSupport/src/org/intellij/lang/regexp/RegExpHighlighter.java index 141391a7cbeb..17da2ae193b4 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/RegExpHighlighter.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/RegExpHighlighter.java @@ -78,10 +78,6 @@ class RegExpHighlighter extends SyntaxHighlighterBase { "REGEXP.QUOTE_CHARACTER", SyntaxHighlighterColors.VALID_STRING_ESCAPE.getDefaultAttributes() ); - static final TextAttributesKey CTRL_CHARACTER = TextAttributesKey.createTextAttributesKey( - "REGEXP.CTRL_CHARACTER", - SyntaxHighlighterColors.VALID_STRING_ESCAPE.getDefaultAttributes() - ); static final TextAttributesKey COMMENT = TextAttributesKey.createTextAttributesKey( "REGEXP.COMMENT", SyntaxHighlighterColors.LINE_COMMENT.getDefaultAttributes() @@ -108,7 +104,6 @@ class RegExpHighlighter extends SyntaxHighlighterBase { keys1.put(RegExpTT.BAD_HEX_VALUE, INVALID_CHARACTER_ESCAPE); keys1.put(RegExpTT.BAD_OCT_VALUE, INVALID_CHARACTER_ESCAPE); - keys1.put(RegExpTT.CTRL_CHARACTER, CTRL_CHARACTER); keys1.put(RegExpTT.PROPERTY, CHAR_CLASS); keys1.put(RegExpTT.ESC_CHARACTER, ESC_CHARACTER);