(ctx context.Context, span core.TextRange, file *ast.SourceFile, kind FormatRequestKind)
| 56 | } |
| 57 | |
| 58 | func FormatSpan(ctx context.Context, span core.TextRange, file *ast.SourceFile, kind FormatRequestKind) []core.TextChange { |
| 59 | // find the smallest node that fully wraps the range and compute the initial indentation for the node |
| 60 | enclosingNode := findEnclosingNode(span, file) |
| 61 | opts := GetFormatCodeSettingsFromContext(ctx) |
| 62 | |
| 63 | return newFormattingScanner( |
| 64 | file.Text(), |
| 65 | file.LanguageVariant, |
| 66 | getScanStartPosition(enclosingNode, span, file), |
| 67 | span.End(), |
| 68 | newFormatSpanWorker( |
| 69 | ctx, |
| 70 | span, |
| 71 | enclosingNode, |
| 72 | GetIndentationForNode(enclosingNode, &span, file, opts), |
| 73 | getOwnOrInheritedDelta(enclosingNode, opts, file), |
| 74 | kind, |
| 75 | prepareRangeContainsErrorFunction(file.Diagnostics(), span), |
| 76 | file, |
| 77 | ), |
| 78 | ) |
| 79 | } |
| 80 | |
| 81 | func 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()) |
no test coverage detected