MCPcopy Create free account
hub / github.com/microsoft/typescript-go / FormatNodeGivenIndentation

Function FormatNodeGivenIndentation

internal/format/api.go:81–99  ·  view source on GitHub ↗
(ctx context.Context, node *ast.Node, file *ast.SourceFile, languageVariant core.LanguageVariant, initialIndentation int, delta int)

Source from the content-addressed store, hash-verified

79}
80
81func FormatNodeGivenIndentation(ctx context.Context, node *ast.Node, file *ast.SourceFile, languageVariant core.LanguageVariant, initialIndentation int, delta int) []core.TextChange {
82 textRange := core.NewTextRange(node.Pos(), node.End())
83 return newFormattingScanner(
84 file.Text(),
85 languageVariant,
86 textRange.Pos(),
87 textRange.End(),
88 newFormatSpanWorker(
89 ctx,
90 textRange,
91 node,
92 initialIndentation,
93 delta,
94 FormatRequestKindFormatSelection,
95 func(core.TextRange) bool { return false }, // assume that node does not have any errors
96 file,
97 ),
98 )
99}
100
101func formatNodeLines(ctx context.Context, sourceFile *ast.SourceFile, node *ast.Node, requestKind FormatRequestKind) []core.TextChange {
102 if node == nil {

Callers 2

printAndFormatNodeMethod · 0.92

Calls 8

PosMethod · 0.95
EndMethod · 0.95
NewTextRangeFunction · 0.92
newFormattingScannerFunction · 0.85
newFormatSpanWorkerFunction · 0.85
PosMethod · 0.65
EndMethod · 0.65
TextMethod · 0.65

Tested by

no test coverage detected