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

Method processRange

internal/format/span.go:752–771  ·  view source on GitHub ↗
(r TextRangeWithKind, rangeStartLine int, rangeStartCharacter int, parent *ast.Node, contextNode *ast.Node, dynamicIndentation *dynamicIndenter)

Source from the content-addressed store, hash-verified

750)
751
752func (w *formatSpanWorker) processRange(r TextRangeWithKind, rangeStartLine int, rangeStartCharacter int, parent *ast.Node, contextNode *ast.Node, dynamicIndentation *dynamicIndenter) LineAction {
753 rangeHasError := w.rangeContainsError(r.Loc)
754 lineAction := LineActionNone
755 if !rangeHasError {
756 if w.previousRange == NewTextRangeWithKind(0, 0, 0) {
757 // trim whitespaces starting from the beginning of the span up to the current line
758 originalStartLine := scanner.GetECMALineOfPosition(w.sourceFile, w.originalRange.Pos())
759 w.trimTrailingWhitespacesForLines(originalStartLine, rangeStartLine, NewTextRangeWithKind(0, 0, 0))
760 } else {
761 lineAction = w.processPair(r, rangeStartLine, parent, w.previousRange, w.previousRangeStartLine, w.previousParent, contextNode, dynamicIndentation)
762 }
763 }
764
765 w.previousRange = r
766 w.previousRangeTriviaEnd = r.Loc.End()
767 w.previousParent = parent
768 w.previousRangeStartLine = rangeStartLine
769
770 return lineAction
771}
772
773func (w *formatSpanWorker) processTrivia(trivia []TextRangeWithKind, parent *ast.Node, contextNode *ast.Node, dynamicIndentation *dynamicIndenter) {
774 for _, triviaItem := range trivia {

Callers 3

executeMethod · 0.95
processTriviaMethod · 0.95

Calls 6

processPairMethod · 0.95
GetECMALineOfPositionFunction · 0.92
NewTextRangeWithKindFunction · 0.85
PosMethod · 0.65
EndMethod · 0.65

Tested by

no test coverage detected