Search in sources :

Example 1 with HtmlPolicy

use of com.intellij.psi.formatter.xml.HtmlPolicy in project intellij-community by JetBrains.

the class HtmlFormattingModelBuilder method createModel.

@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
    final PsiFile psiFile = element.getContainingFile();
    final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(psiFile);
    return new XmlFormattingModel(psiFile, new XmlBlock(SourceTreeToPsiMap.psiElementToTree(psiFile), null, null, new HtmlPolicy(settings, documentModel), null, null, false), documentModel);
}
Also used : HtmlPolicy(com.intellij.psi.formatter.xml.HtmlPolicy) XmlBlock(com.intellij.psi.formatter.xml.XmlBlock) PsiFile(com.intellij.psi.PsiFile) XmlFormattingModel(com.intellij.lang.xml.XmlFormattingModel) FormattingDocumentModelImpl(com.intellij.psi.formatter.FormattingDocumentModelImpl) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with HtmlPolicy

use of com.intellij.psi.formatter.xml.HtmlPolicy in project intellij-community by JetBrains.

the class XhtmlFormattingModelBuilder method createModel.

@Override
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
    final PsiFile psiFile = element.getContainingFile();
    final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(psiFile);
    return new XmlFormattingModel(psiFile, new XmlBlock(SourceTreeToPsiMap.psiElementToTree(psiFile), null, null, new HtmlPolicy(settings, documentModel), null, null, false), documentModel);
}
Also used : HtmlPolicy(com.intellij.psi.formatter.xml.HtmlPolicy) XmlBlock(com.intellij.psi.formatter.xml.XmlBlock) PsiFile(com.intellij.psi.PsiFile) XmlFormattingModel(com.intellij.lang.xml.XmlFormattingModel) FormattingDocumentModelImpl(com.intellij.psi.formatter.FormattingDocumentModelImpl) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with HtmlPolicy

use of com.intellij.psi.formatter.xml.HtmlPolicy in project intellij-plugins by JetBrains.

the class HbFormattingModelBuilder method createTemplateLanguageBlock.

@Override
public TemplateLanguageBlock createTemplateLanguageBlock(@NotNull ASTNode node, @Nullable Wrap wrap, @Nullable Alignment alignment, @Nullable List<DataLanguageBlockWrapper> foreignChildren, @NotNull CodeStyleSettings codeStyleSettings) {
    final FormattingDocumentModelImpl documentModel = FormattingDocumentModelImpl.createOn(node.getPsi().getContainingFile());
    HtmlPolicy policy = new HtmlPolicy(codeStyleSettings, documentModel);
    return HbTokenTypes.TAGS.contains(node.getElementType()) ? new HandlebarsTagBlock(node, wrap, alignment, this, codeStyleSettings, foreignChildren, policy) : new HandlebarsBlock(node, wrap, alignment, this, codeStyleSettings, foreignChildren, policy);
}
Also used : HtmlPolicy(com.intellij.psi.formatter.xml.HtmlPolicy) FormattingDocumentModelImpl(com.intellij.psi.formatter.FormattingDocumentModelImpl)

Aggregations

FormattingDocumentModelImpl (com.intellij.psi.formatter.FormattingDocumentModelImpl)3 HtmlPolicy (com.intellij.psi.formatter.xml.HtmlPolicy)3 XmlFormattingModel (com.intellij.lang.xml.XmlFormattingModel)2 PsiFile (com.intellij.psi.PsiFile)2 XmlBlock (com.intellij.psi.formatter.xml.XmlBlock)2 NotNull (org.jetbrains.annotations.NotNull)2