summaryrefslogtreecommitdiff
path: root/spellchecker
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-04-19 13:32:49 -0700
committerTor Norbye <tnorbye@google.com>2013-04-19 13:32:49 -0700
commitb569bc6aa78f6eacf72e8b90622d300e1a9db25f (patch)
tree309048e52eab434a381cf8554436f14de6342cbf /spellchecker
parentd1a59a0799588a226d255d9b45c4825b19651554 (diff)
downloadidea-b569bc6aa78f6eacf72e8b90622d300e1a9db25f.tar.gz
Snapshot 0b0329a61f47b6070bb9084be8e176635a16fa5c from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: I2e8857776f197bed2d768ea37c67d2e2a1e97952
Diffstat (limited to 'spellchecker')
-rw-r--r--spellchecker/src/com/intellij/spellchecker/actions/SpellingPopupActionGroup.java1
-rw-r--r--spellchecker/src/com/intellij/spellchecker/english.dic1
-rw-r--r--spellchecker/src/com/intellij/spellchecker/jetbrains.dic1
-rw-r--r--spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java32
4 files changed, 30 insertions, 5 deletions
diff --git a/spellchecker/src/com/intellij/spellchecker/actions/SpellingPopupActionGroup.java b/spellchecker/src/com/intellij/spellchecker/actions/SpellingPopupActionGroup.java
index de7a5aeefb9c..96eea9a6d60e 100644
--- a/spellchecker/src/com/intellij/spellchecker/actions/SpellingPopupActionGroup.java
+++ b/spellchecker/src/com/intellij/spellchecker/actions/SpellingPopupActionGroup.java
@@ -48,6 +48,7 @@ public final class SpellingPopupActionGroup extends ActionGroup {
super(shortName, popup);
}
+ @NotNull
public AnAction[] getChildren(@Nullable AnActionEvent e) {
if (e != null) {
AnAction[] children = findActions(e);
diff --git a/spellchecker/src/com/intellij/spellchecker/english.dic b/spellchecker/src/com/intellij/spellchecker/english.dic
index 6843249fd774..29b784875e3b 100644
--- a/spellchecker/src/com/intellij/spellchecker/english.dic
+++ b/spellchecker/src/com/intellij/spellchecker/english.dic
@@ -4134,6 +4134,7 @@ Brana
Brana's
Branch
Branch's
+Branchy
Brand
Brand's
Brandais
diff --git a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic
index dcbd493a0617..965091849ddb 100644
--- a/spellchecker/src/com/intellij/spellchecker/jetbrains.dic
+++ b/spellchecker/src/com/intellij/spellchecker/jetbrains.dic
@@ -24,6 +24,7 @@ backend
backtrace
barcode
basedir
+basename
basicfile
batis
bfile
diff --git a/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java b/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java
index 0d5a48e3c5bb..19cee092f55b 100644
--- a/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java
+++ b/spellchecker/src/com/intellij/spellchecker/tokenizer/SpellcheckingStrategy.java
@@ -18,10 +18,9 @@ package com.intellij.spellchecker.tokenizer;
import com.intellij.codeInsight.daemon.impl.actions.AbstractSuppressByNoInspectionCommentFix;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.PsiComment;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiNameIdentifierOwner;
-import com.intellij.psi.PsiPlainText;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.*;
+import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.psi.xml.XmlAttributeValue;
import com.intellij.psi.xml.XmlText;
import com.intellij.spellchecker.inspections.PlainTextSplitter;
@@ -34,7 +33,7 @@ import org.jetbrains.annotations.NotNull;
public class SpellcheckingStrategy {
protected final Tokenizer<PsiComment> myCommentTokenizer = new CommentTokenizer();
- protected final Tokenizer<XmlAttributeValue> myXmlAttributeTokenizer = TokenizerBase.create(TextSplitter.getInstance());
+ protected final Tokenizer<XmlAttributeValue> myXmlAttributeTokenizer = new XmlAttributeValueTokenizer();
protected final Tokenizer<XmlText> myXmlTextTokenizer = new XmlTextTokenizer();
public static final ExtensionPointName<SpellcheckingStrategy> EP_NAME = ExtensionPointName.create("com.intellij.spellchecker.support");
@@ -85,4 +84,27 @@ public class SpellcheckingStrategy {
public static SpellCheckerQuickFix[] getDefaultBatchFixes() {
return BATCH_FIXES;
}
+
+ private static class XmlAttributeValueTokenizer extends Tokenizer<XmlAttributeValue> {
+ public void tokenize(@NotNull final XmlAttributeValue element, final TokenConsumer consumer) {
+ if (element instanceof PsiLanguageInjectionHost && InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)element)) return;
+
+ final String valueTextTrimmed = element.getValue().trim();
+ // do not inspect colors like #00aaFF
+ if (valueTextTrimmed.startsWith("#") && valueTextTrimmed.length() <= 7 && isHexString(valueTextTrimmed.substring(1))) {
+ return;
+ }
+
+ consumer.consumeToken(element, TextSplitter.getInstance());
+ }
+
+ private static boolean isHexString(final String s) {
+ for (int i = 0; i < s.length(); i++) {
+ if (!StringUtil.isHexDigit(s.charAt(i))) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
}