HTML: enable autopopup after < and & only

This commit is contained in:
Alexander Zolotov
2014-05-06 19:44:53 +04:00
parent be5c39d06f
commit b53ff16c92
2 changed files with 10 additions and 2 deletions
@@ -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;
}
}
@@ -32,7 +32,15 @@ public class XmlAutopopupTest extends CompletionAutoPopupTestCase {
doTestNoPopup(XHtmlFileType.INSTANCE, "<div><caret></div>", "p");
}
public void testAfterTagOpenXhtml() throws Exception {
public void testAfterAmpersand() {
doTestPopup(HtmlFileType.INSTANCE, "<div>&<caret></div>", "t");
}
public void testDoNotShowPopupAfterQuotedSymbol() {
doTestNoPopup(HtmlFileType.INSTANCE, "<div>\"<caret></div>", "s");
}
public void testAfterTagOpenXhtml() {
doTestPopup(XHtmlFileType.INSTANCE, "<div><caret></div>", "<");
}