From 07e53959630dee381c6989c3941ebe835b339f74 Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Tue, 1 Jul 2014 19:17:16 +0400 Subject: [PATCH] improve java string literal tokenizer: don't show typos twice for injected code --- .../intellij/spellchecker/LiteralExpressionTokenizer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java b/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java index 77246ec92763..2eade6903cd2 100644 --- a/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java +++ b/java/java-impl/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java @@ -17,8 +17,10 @@ package com.intellij.spellchecker; import com.intellij.codeInsight.AnnotationUtil; import com.intellij.psi.JavaTokenType; +import com.intellij.psi.PsiLanguageInjectionHost; import com.intellij.psi.PsiLiteralExpression; import com.intellij.psi.PsiModifierListOwner; +import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.impl.source.tree.java.PsiLiteralExpressionImpl; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.spellchecker.inspections.PlainTextSplitter; @@ -30,8 +32,6 @@ import org.jetbrains.annotations.NotNull; import java.util.Collections; /** - * Created by IntelliJ IDEA. - * * @author shkate@jetbrains.com */ public class LiteralExpressionTokenizer extends Tokenizer { @@ -42,6 +42,8 @@ public class LiteralExpressionTokenizer extends Tokenizer return; // not a string literal } + if (InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost)element)) return; + final PsiModifierListOwner listOwner = PsiTreeUtil.getParentOfType(element, PsiModifierListOwner.class); if (listOwner != null && AnnotationUtil.isAnnotated(listOwner, Collections.singleton(AnnotationUtil.NON_NLS), false, false)) { return;