use of org.angularjs.codeInsight.tags.AngularJSTagDescriptor in project intellij-plugins by JetBrains.
the class AngularJSErrorFilter method shouldHighlightErrorElement.
@Override
public boolean shouldHighlightErrorElement(@NotNull PsiErrorElement error) {
final Project project = error.getProject();
final Language language = error.getLanguage();
if ("CSS".equals(language.getID()) && PsiTreeUtil.getParentOfType(error, XmlAttribute.class) != null && AngularIndexUtil.hasAngularJS(project)) {
final PsiFile file = error.getContainingFile();
PsiErrorElement nextError = error;
while (nextError != null) {
if (hasAngularInjectionAt(project, file, nextError.getTextOffset()))
return false;
nextError = PsiTreeUtil.getNextSiblingOfType(nextError, PsiErrorElement.class);
}
}
if (HTMLLanguage.INSTANCE.is(language) && error.getErrorDescription().endsWith("not closed")) {
final PsiElement parent = error.getParent();
final XmlElementDescriptor descriptor = parent instanceof XmlTag ? ((XmlTag) parent).getDescriptor() : null;
return !(descriptor instanceof AngularJSTagDescriptor);
}
if (XMLLanguage.INSTANCE.is(language) && error.getErrorDescription().equals(XmlErrorMessages.message("xml.parsing.unexpected.tokens"))) {
return !error.getParent().getLanguage().is(Angular2HTMLLanguage.INSTANCE);
}
return true;
}
Aggregations