public interface FormattingModel
Typically, a plugin does not need to provide a complete FormattingModel implementation -
it can either use a complete implementation provided by
FormattingModelProvider.createFormattingModelForPsiFile(com.intellij.psi.PsiFile, Block, com.intellij.psi.codeStyle.CodeStyleSettings)
or implement the necessary extra features and delegate the rest to the factory implementation.
Modifier and Type | Method and Description |
---|---|
void |
commitChanges()
Commits the changes made by the formatter to the document.
|
FormattingDocumentModel |
getDocumentModel()
Returns the formatting document model, which allows the formatter to access information about
the document containing the text to be formatted.
|
Block |
getRootBlock()
Returns the root block of the formatting model.
|
TextRange |
replaceWhiteSpace(TextRange textRange,
java.lang.String whiteSpace)
Replaces the contents of the specified text range in the document with the specified text
string consisting of whitespace characters.
|
TextRange |
shiftIndentInsideRange(ASTNode node,
TextRange range,
int indent)
Indents every line except for the first in the specified text range representing a multiline block
by the specified amount.
|
Block getRootBlock()
FormattingModelBuilder.createModel(com.intellij.psi.PsiElement, com.intellij.psi.codeStyle.CodeStyleSettings)
.FormattingDocumentModel getDocumentModel()
TextRange replaceWhiteSpace(TextRange textRange, java.lang.String whiteSpace)
textRange
- the text range to replace with whitespace.whiteSpace
- the whitespace to replace with.TextRange shiftIndentInsideRange(ASTNode node, TextRange range, int indent)
node
- the owner of the text range, if defined.range
- the text range to indent.indent
- the amount by which every line should be indented.void commitChanges()