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

Method processTrivia

internal/format/span.go:773–780  ·  view source on GitHub ↗
(trivia []TextRangeWithKind, parent *ast.Node, contextNode *ast.Node, dynamicIndentation *dynamicIndenter)

Source from the content-addressed store, hash-verified

771}
772
773func (w *formatSpanWorker) processTrivia(trivia []TextRangeWithKind, parent *ast.Node, contextNode *ast.Node, dynamicIndentation *dynamicIndenter) {
774 for _, triviaItem := range trivia {
775 if isComment(triviaItem.Kind) && triviaItem.Loc.ContainedBy(w.originalRange) {
776 triviaItemStartLine, triviaItemStartCharacter := scanner.GetECMALineAndByteOffsetOfPosition(w.sourceFile, triviaItem.Loc.Pos())
777 w.processRange(triviaItem, triviaItemStartLine, triviaItemStartCharacter, parent, contextNode, dynamicIndentation)
778 }
779 }
780}
781
782/**
783* Trimming will be done for lines after the previous range.

Callers 1

Calls 5

processRangeMethod · 0.95
isCommentFunction · 0.85
ContainedByMethod · 0.80
PosMethod · 0.65

Tested by

no test coverage detected