vue: in .vue files tags get preprocessed anyway, so allow any tag policy

= vue tags can have empty body and be self-closing
WEB-30808 Some of the vue components may have an empty body
This commit is contained in:
Irina.Chernushina
2018-01-30 12:05:57 +01:00
parent 889044b7de
commit 377a606aef
2 changed files with 14 additions and 33 deletions
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xml.util;
@@ -53,7 +39,7 @@ public class CheckEmptyTagInspection extends XmlSuppressableInspectionTool {
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
return new XmlElementVisitor() {
@Override public void visitXmlTag(final XmlTag tag) {
if (!isTagWithEmptyEndNotAllowed(tag)) {
if (XmlExtension.shouldIgnoreSelfClosingTag(tag) || !isTagWithEmptyEndNotAllowed(tag)) {
return;
}
final ASTNode child = XmlChildRole.EMPTY_TAG_END_FINDER.findChild(tag.getNode());
@@ -84,8 +70,8 @@ public class CheckEmptyTagInspection extends XmlSuppressableInspectionTool {
(language.isKindOf(HTMLLanguage.INSTANCE) &&
!HtmlUtil.isSingleHtmlTagL(tagName) &&
tagName.indexOf(':') == -1
&& !XmlExtension.isCollapsible(tag));
tagName.indexOf(':') == -1 &&
!XmlExtension.isCollapsible(tag));
}
@Override
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xml;
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
@@ -202,6 +188,15 @@ public abstract class XmlExtension {
return false;
}
public boolean isSelfClosingTagAllowed(@NotNull XmlTag tag) {
return false;
}
public static boolean shouldIgnoreSelfClosingTag(@NotNull XmlTag tag) {
final XmlExtension extension = getExtensionByElement(tag);
return extension != null && extension.isSelfClosingTagAllowed(tag);
}
public static boolean isCollapsible(XmlTag tag) {
final XmlExtension extension = getExtensionByElement(tag);
return extension == null || extension.isCollapsibleTag(tag);