mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-112914 Insert closing tag after typing </ : fixing tests
This commit is contained in:
@@ -85,7 +85,7 @@ public class XmlSlashTypedHandler extends TypedHandlerDelegate implements XmlTok
|
||||
final String prevLeafText = prevLeaf.getText();
|
||||
if ("</".equals(prevLeafText) && prevLeaf.getElementType() == XML_END_TAG_START) {
|
||||
XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
|
||||
if (tag != null && StringUtil.isNotEmpty(tag.getName())) {
|
||||
if (tag != null && StringUtil.isNotEmpty(tag.getName()) && TreeUtil.findSibling(prevLeaf, XmlTokenType.XML_NAME) == null) {
|
||||
EditorModificationUtil.insertStringAtCaret(editor, tag.getName() + ">");
|
||||
return Result.STOP;
|
||||
}
|
||||
|
||||
@@ -29,4 +29,10 @@ public class XmlTypedHandlersTest extends LightPlatformCodeInsightFixtureTestCas
|
||||
myFixture.type('/');
|
||||
myFixture.checkResult("<foo></foo>");
|
||||
}
|
||||
|
||||
public void testGreedyClosing() {
|
||||
myFixture.configureByText(XmlFileType.INSTANCE, "<foo><<caret>foo>");
|
||||
myFixture.type('/');
|
||||
myFixture.checkResult("<foo></foo>");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user