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

Function GetIndentationForNode

internal/format/indent.go:17–20  ·  view source on GitHub ↗
(n *ast.Node, ignoreActualIndentationRange *core.TextRange, sourceFile *ast.SourceFile, options lsutil.FormatCodeSettings)

Source from the content-addressed store, hash-verified

15)
16
17func GetIndentationForNode(n *ast.Node, ignoreActualIndentationRange *core.TextRange, sourceFile *ast.SourceFile, options lsutil.FormatCodeSettings) int {
18 startline, startpos := scanner.GetECMALineAndByteOffsetOfPosition(sourceFile, scanner.GetTokenPosOfNode(n, sourceFile, false))
19 return getIndentationForNodeWorker(n, startline, startpos, ignoreActualIndentationRange /*indentationDelta*/, 0, sourceFile /*isNextChild*/, false, options)
20}
21
22// GetIndentation computes the expected indentation for a position in a source file.
23// This is the Go port of SmartIndenter.getIndentation from TypeScript.

Callers 1

FormatSpanFunction · 0.85

Calls 3

GetTokenPosOfNodeFunction · 0.92

Tested by

no test coverage detected