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

Function GetECMAEndLinePosition

internal/scanner/scanner.go:2703–2712  ·  view source on GitHub ↗
(sourceFile *ast.SourceFile, line int)

Source from the content-addressed store, hash-verified

2701}
2702
2703func GetECMAEndLinePosition(sourceFile *ast.SourceFile, line int) int {
2704 pos := int(GetECMALineStarts(sourceFile)[line])
2705 for {
2706 ch, size := utf8.DecodeRuneInString(sourceFile.Text()[pos:])
2707 if size == 0 || stringutil.IsLineBreak(ch) {
2708 return pos - 1
2709 }
2710 pos += size
2711 }
2712}
2713
2714// GetECMAPositionOfLineAndUTF16Character converts a 0-based line number and UTF-16
2715// code unit character offset back to an absolute byte position in the source text.

Callers 4

FormatOnEnterFunction · 0.92

Calls 4

IsLineBreakFunction · 0.92
GetECMALineStartsFunction · 0.85
TextMethod · 0.65
intInterface · 0.50

Tested by

no test coverage detected