forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlineMap.ts
More file actions
17 lines (14 loc) · 709 Bytes
/
Copy pathlineMap.ts
File metadata and controls
17 lines (14 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
///<reference path='references.ts' />
module TypeScript {
export module LineMap1 {
export function fromSimpleText(text: ISimpleText): LineMap {
return new LineMap(() => TextUtilities.parseLineStarts({ charCodeAt: index => text.charCodeAt(index), length: text.length() }), text.length());
}
export function fromScriptSnapshot(scriptSnapshot: IScriptSnapshot): LineMap {
return new LineMap(() => scriptSnapshot.getLineStartPositions(), scriptSnapshot.getLength());
}
export function fromString(text: string): LineMap {
return new LineMap(() => TextUtilities.parseLineStarts(text), text.length);
}
}
}