mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-160408 Quote not recognized as an end to String
This commit is contained in:
+10
@@ -108,6 +108,16 @@ public class ReferenceInjectionTest extends LightCodeInsightFixtureTestCase {
|
||||
myFixture.testHighlighting();
|
||||
}
|
||||
|
||||
public void testEmptyLiteral() throws Exception {
|
||||
myFixture.configureByText("Foo.java", "class Foo {\n" +
|
||||
" void bar() {\n" +
|
||||
" @org.intellij.lang.annotations.Language(\"encoding-reference\")\n" +
|
||||
" String cset = true ? <error descr=\"Unknown encoding: ''\">\"\"</error> : \"utf-8\";//\n" +
|
||||
" }\n" +
|
||||
"}");
|
||||
myFixture.testHighlighting();
|
||||
}
|
||||
|
||||
private PsiReference[] getInjectedReferences() {
|
||||
PsiElement element = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
|
||||
element = PsiTreeUtil.getParentOfType(element, PsiLanguageInjectionHost.class);
|
||||
|
||||
+10
-1
@@ -16,7 +16,9 @@
|
||||
package org.intellij.plugins.intelliLang.references;
|
||||
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiReference;
|
||||
@@ -39,7 +41,14 @@ public class InjectedReferencesInspection extends LocalInspectionTool {
|
||||
if (injected != null) {
|
||||
for (PsiReference reference : injected) {
|
||||
if (reference.resolve() == null) {
|
||||
holder.registerProblem(reference);
|
||||
TextRange range = reference.getRangeInElement();
|
||||
if (range.isEmpty() && range.getStartOffset() == 1 && "\"\"".equals(element.getText())) {
|
||||
String message = ProblemsHolder.unresolvedReferenceMessage(reference);
|
||||
holder.registerProblem(element, message, ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, TextRange.create(0, 2));
|
||||
}
|
||||
else {
|
||||
holder.registerProblem(reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user