mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-150753 Make 'Collapse empty tag' quick fix available for tags with whitespace contents
This commit is contained in:
@@ -34,4 +34,9 @@ public class CollapseTagTest extends LightPlatformCodeInsightFixtureTestCase{
|
||||
PsiFile file = myFixture.configureByText(XmlFileType.INSTANCE, "<a> <caret> <b/> </a>");
|
||||
assertFalse(new CollapseTagIntention().isAvailable(getProject(), myFixture.getEditor(), file));
|
||||
}
|
||||
|
||||
public void testAlreadyCollapsed() throws Exception {
|
||||
PsiFile file = myFixture.configureByText(XmlFileType.INSTANCE, "<a/>");
|
||||
assertFalse(new CollapseTagIntention().isAvailable(getProject(), myFixture.getEditor(), file));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class CollapseTagIntention implements LocalQuickFix, IntentionAction {
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
|
||||
XmlTag tag = getTag(editor, file);
|
||||
return tag != null && tag.getSubTags().length == 0 && tag.getValue().getTrimmedText().isEmpty();
|
||||
return tag != null && !tag.isEmpty() && tag.getSubTags().length == 0 && tag.getValue().getTrimmedText().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user