Abstract
Options that determine when the formatDocumentOnType
method should be invoked by the language client.
When undefined
is returned, document format on type will be disabled.
Protected
avoidProtected
createProtected
createProtected
createProtected
createProtected
createProtected
doOptional
range: RangeProtected
findProtected
fitProtected
Abstract
formatHandles full document formatting.
Handles document formatting while typing. Only formats the current line.
Handles partial document formatting. Only parts of the document within the params.range
property are formatted.
Protected
getProtected
getOptional
formattingMove: FormattingMoveProtected
getCreates a formatter scoped to the supplied AST node. Allows to define fine-grained formatting rules for elements.
Example usage:
export class CustomFormatter extends AbstractFormatter {
protected override format(node: AstNode): void {
if (isPerson(node)) {
const formatter = this.getNodeFormatter(node);
formatter.property('name').prepend(Formatting.oneSpace());
}
}
}
The specific node the formatter should be scoped to. Every call to properties or keywords will only select those which belong to the supplied AST node.
Protected
insideProtected
isReturns whether a range for a given document is error free, i.e. safe to format
Document to inspect for lexer & parser errors that may produce an unsafe range
Formatting range to check for safety
Whether the given formatting range does not overlap with or follow any regions with an error
Protected
isProtected
iterateOptional
range: RangeProtected
iterateProtected
iterateOptional
range: RangeProtected
iterateProtected
node
Language specific service for handling formatting related LSP requests.