Skip to content

Commit 8debdea

Browse files
committed
add type alias for line starts
1 parent 4a6c6ea commit 8debdea

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

internal/core/core.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,9 @@ func Coalesce[T *U, U any](a T, b T) T {
362362
}
363363
}
364364

365-
func ComputeECMALineStarts(text string) []TextPos {
365+
type ECMALineStarts []TextPos
366+
367+
func ComputeECMALineStarts(text string) ECMALineStarts {
366368
result := make([]TextPos, 0, strings.Count(text, "\n")+1)
367369
return slices.AppendSeq(result, ComputeECMALineStartsSeq(text))
368370
}

internal/ls/linemap.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import (
99
"github.com/microsoft/typescript-go/internal/core"
1010
)
1111

12+
type LSPLineStarts []core.TextPos
13+
1214
type LSPLineMap struct {
1315
LineStarts []core.TextPos
1416
AsciiOnly bool // TODO(jakebailey): collect ascii-only info per line

internal/sourcemap/lineinfo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import "github.com/microsoft/typescript-go/internal/core"
44

55
type ECMALineInfo struct {
66
text string
7-
lineStarts []core.TextPos
7+
lineStarts core.ECMALineStarts
88
}
99

10-
func CreateECMALineInfo(text string, lineStarts []core.TextPos) *ECMALineInfo {
10+
func CreateECMALineInfo(text string, lineStarts core.ECMALineStarts) *ECMALineInfo {
1111
return &ECMALineInfo{
1212
text: text,
1313
lineStarts: lineStarts,

0 commit comments

Comments
 (0)