mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
list all colors and provide full preview in regexp color settings page; remove color which is very unlikely to be usefully highlighted
This commit is contained in:
@@ -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<String,TextAttributesKey> ourTagToDescriptorMap = new HashMap<String, TextAttributesKey>();
|
||||
@@ -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$";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user