@RequiredReadAction private RangeMarker findSupport(RangeMarker leader, PsiFile file, Document document) { final int offset = leader.getStartOffset(); PsiElement element = InjectedLanguageUtil.findElementAtNoCommit(file, offset); PsiElement support = findSupportElement(element); if(support == null && file.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) { element = file.getViewProvider().findElementAt(offset, myLanguage); support = findSupportElement(element); } if(support == null) { return null; } final TextRange range = support.getTextRange(); TextRange realRange = InjectedLanguageManager.getInstance(file.getProject()).injectedToHost(element.getContainingFile(), range); return document.createRangeMarker(realRange.getStartOffset(), realRange.getEndOffset(), true); }
@Nullable private static ExternalLintAnnotationInput collectInformation(@NotNull PsiFile psiFile, @Nullable Editor editor) { if (psiFile.getContext() != null || !SassLintConfigFileUtil.isSassFile(psiFile)) { return null; } VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile == null || !virtualFile.isInLocalFileSystem()) { return null; } if (psiFile.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) { return null; } Project project = psiFile.getProject(); SassLintProjectComponent component = project.getComponent(SassLintProjectComponent.class); if (!component.isSettingsValid() || !component.isEnabled()) { return null; } Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile); if (document == null) { return null; } String fileContent = document.getText(); if (StringUtil.isEmptyOrSpaces(fileContent)) { return null; } EditorColorsScheme colorsScheme = editor != null ? editor.getColorsScheme() : null; // tabSize = getTabSize(editor); // tabSize = 4; return new ExternalLintAnnotationInput(project, psiFile, fileContent, colorsScheme); }
@Override public boolean isSupported(@NotNull Class visitorClass, @NotNull PsiFile file) { if (visitorClass == StringLiteralQuotesAnnotator.class && file.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) { return false; } return true; }
@Override protected void checkValue(XmlAttributeValue value, XmlFile file, XmlRefCountHolder refHolder, XmlTag tag, ProblemsHolder holder) { String idRef = XmlHighlightVisitor.getUnquotedValue(value, tag); if (tag instanceof HtmlTag) { idRef = idRef.toLowerCase(); } if (XmlUtil.isSimpleValue(idRef, value) && refHolder.isIdReferenceValue(value)) { boolean hasIdDeclaration = refHolder.hasIdDeclaration(idRef); if (!hasIdDeclaration && tag instanceof HtmlTag) { hasIdDeclaration = refHolder.hasIdDeclaration(value.getValue()); } if (!hasIdDeclaration) { for(XmlIdContributor contributor: Extensions.getExtensions(XmlIdContributor.EP_NAME)) { if (contributor.suppressExistingIdValidation(file)) { return; } } final FileViewProvider viewProvider = tag.getContainingFile().getViewProvider(); if (viewProvider instanceof MultiplePsiFilesPerDocumentFileViewProvider) { holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, new XmlDeclareIdInCommentAction(idRef)); } else { holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); } } } }
@Nullable private static ExternalLintAnnotationInput collectInformation(@NotNull PsiFile psiFile, @Nullable Editor editor) { if (psiFile.getContext() != null || !RTFileUtil.isRTFile(psiFile)) { return null; } VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile == null || !virtualFile.isInLocalFileSystem()) { return null; } if (psiFile.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) { return null; } Project project = psiFile.getProject(); RTProjectComponent component = project.getComponent(RTProjectComponent.class); if (component == null || !component.isValidAndEnabled()) { return null; } Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile); if (document == null) { return null; } String fileContent = document.getText(); if (StringUtil.isEmptyOrSpaces(fileContent)) { return null; } EditorColorsScheme colorsScheme = editor == null ? null : editor.getColorsScheme(); // tabSize = getTabSize(editor); // tabSize = 4; return new ExternalLintAnnotationInput(project, psiFile, fileContent, colorsScheme); }
@Nullable private static ExternalLintAnnotationInput collectInformation(@NotNull PsiFile psiFile, @Nullable Editor editor) { if (psiFile.getContext() != null || !CoffeeLintConfigFileUtil.isCoffeeScriptFile(psiFile)) { return null; } VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile == null || !virtualFile.isInLocalFileSystem()) { return null; } if (psiFile.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) { return null; } Project project = psiFile.getProject(); CoffeeLintProjectComponent component = project.getComponent(CoffeeLintProjectComponent.class); if (!component.isSettingsValid() || !component.isEnabled()) { return null; } Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile); if (document == null) { return null; } String fileContent = document.getText(); if (StringUtil.isEmptyOrSpaces(fileContent)) { return null; } EditorColorsScheme colorsScheme = editor != null ? editor.getColorsScheme() : null; // tabSize = getTabSize(editor); // tabSize = 4; return new ExternalLintAnnotationInput(project, psiFile, fileContent, colorsScheme); }
@Nullable private static ExternalLintAnnotationInput collectInformation(@NotNull PsiFile psiFile, @Nullable Editor editor) { if (psiFile.getContext() != null) { return null; } VirtualFile virtualFile = psiFile.getVirtualFile(); if (virtualFile == null || !virtualFile.isInLocalFileSystem()) { return null; } if (psiFile.getViewProvider() instanceof MultiplePsiFilesPerDocumentFileViewProvider) { return null; } Project project = psiFile.getProject(); ESLintProjectComponent component = project.getComponent(ESLintProjectComponent.class); if (!component.isSettingsValid() || !component.isEnabled() || !isJavaScriptFile(psiFile, component.ext)) { return null; } Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile); if (document == null) { return null; } String fileContent = document.getText(); if (StringUtil.isEmptyOrSpaces(fileContent)) { return null; } EditorColorsScheme colorsScheme = editor == null ? null : editor.getColorsScheme(); // tabSize = getTabSize(editor); // tabSize = 4; return new ExternalLintAnnotationInput(project, psiFile, fileContent, colorsScheme); }
protected void checkValue(XmlAttributeValue value, XmlFile file, XmlRefCountHolder refHolder, XmlTag tag, ProblemsHolder holder) { String idRef = XmlHighlightVisitor.getUnquotedValue(value, tag); if (tag instanceof HtmlTag) { idRef = idRef.toLowerCase(); } if (XmlUtil.isSimpleXmlAttributeValue(idRef, value) && refHolder.isIdReferenceValue(value)) { boolean hasIdDeclaration = refHolder.hasIdDeclaration(idRef); if (!hasIdDeclaration && tag instanceof HtmlTag) { hasIdDeclaration = refHolder.hasIdDeclaration(value.getValue()); } if (!hasIdDeclaration) { for(XmlIdContributor contributor: Extensions.getExtensions(XmlIdContributor.EP_NAME)) { if (contributor.suppressExistingIdValidation(file)) { return; } } final FileViewProvider viewProvider = tag.getContainingFile().getViewProvider(); if (viewProvider instanceof MultiplePsiFilesPerDocumentFileViewProvider) { holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, new XmlDeclareIdInCommentAction(idRef)); } else { holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); } } } }
protected void checkValue(XmlAttributeValue value, XmlFile file, XmlRefCountHolder refHolder, XmlTag tag, ProblemsHolder holder) { String idRef = XmlHighlightVisitor.getUnquotedValue(value, tag); if (tag instanceof HtmlTag) { idRef = idRef.toLowerCase(); } if (XmlUtil.isSimpleValue(idRef, value) && refHolder.isIdReferenceValue(value)) { boolean hasIdDeclaration = refHolder.hasIdDeclaration(idRef); if (!hasIdDeclaration && tag instanceof HtmlTag) { hasIdDeclaration = refHolder.hasIdDeclaration(value.getValue()); } if (!hasIdDeclaration) { for(XmlIdContributor contributor: Extensions.getExtensions(XmlIdContributor.EP_NAME)) { if (contributor.suppressExistingIdValidation(file)) { return; } } final FileViewProvider viewProvider = tag.getContainingFile().getViewProvider(); if (viewProvider instanceof MultiplePsiFilesPerDocumentFileViewProvider) { holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL, new XmlDeclareIdInCommentAction(idRef)); } else { holder.registerProblem(value, XmlErrorMessages.message("invalid.id.reference"), ProblemHighlightType.LIKE_UNKNOWN_SYMBOL); } } } }
@Override protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile) { return new SoyFileViewProvider(getManager(), virtualFile, false); }
@Override protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile) { return new RythmFileViewProvider(getManager(), virtualFile, false, myBaseLanguage, myTemplateLanguage); }
@Override protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile file) { return new JetFileViewProvider(getManager(), file, false, myTemplateDataLanguage); }
@Override protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile) { return new RestFileViewProvider(getManager(), virtualFile, false); }
@Override protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile fileCopy) { return new LatteFileViewProvider(getManager(), fileCopy, false); }
@Override protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile) { return new DotFileViewProvider(getManager(), virtualFile, false); }
@Override protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile fileCopy) { return new PlayBaseTemplateFileViewProvider(getManager(), fileCopy, isPhysical()); }
@Override protected MultiplePsiFilesPerDocumentFileViewProvider cloneInner(VirtualFile virtualFile) { return new JspFileViewProviderImpl(getManager(), virtualFile, false); }