From b53ff16c92b56b65c286bf0dd8215a2aac82a8ed Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Mon, 5 May 2014 20:59:11 +0400 Subject: [PATCH] HTML: enable autopopup after < and & only --- .../completion/HtmlTextCompletionConfidence.java | 2 +- .../codeInsight/completion/XmlAutopopupTest.java | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/xml/impl/resources/com/intellij/codeInsight/completion/HtmlTextCompletionConfidence.java b/xml/impl/resources/com/intellij/codeInsight/completion/HtmlTextCompletionConfidence.java index d732b4f7ba11..ec6c806ffa1f 100644 --- a/xml/impl/resources/com/intellij/codeInsight/completion/HtmlTextCompletionConfidence.java +++ b/xml/impl/resources/com/intellij/codeInsight/completion/HtmlTextCompletionConfidence.java @@ -34,7 +34,7 @@ public class HtmlTextCompletionConfidence extends CompletionConfidence { PsiElement parent = contextElement.getParent(); if (parent instanceof XmlText || parent instanceof XmlDocument) { String prefix = contextElement.getText().substring(0, offset - contextElement.getTextRange().getStartOffset()); - if (StringUtil.isJavaIdentifier(prefix)) { + if (!StringUtil.startsWithChar(prefix, '<') && !StringUtil.startsWithChar(prefix, '&')) { return ThreeState.YES; } } diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlAutopopupTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlAutopopupTest.java index 0afeea7e2867..0323a0de1ed6 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlAutopopupTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlAutopopupTest.java @@ -32,7 +32,15 @@ public class XmlAutopopupTest extends CompletionAutoPopupTestCase { doTestNoPopup(XHtmlFileType.INSTANCE, "
", "p"); } - public void testAfterTagOpenXhtml() throws Exception { + public void testAfterAmpersand() { + doTestPopup(HtmlFileType.INSTANCE, "
&
", "t"); + } + + public void testDoNotShowPopupAfterQuotedSymbol() { + doTestNoPopup(HtmlFileType.INSTANCE, "
\"
", "s"); + } + + public void testAfterTagOpenXhtml() { doTestPopup(XHtmlFileType.INSTANCE, "
", "<"); }