MCPcopy Create free account
hub / github.com/Snapchat/Valdi / positionToOffset

Function positionToOffset

valdi/vscode_debugger/src/common/sourceUtils.ts:270–276  ·  view source on GitHub ↗
(text: string, line: number, column: number)

Source from the content-addressed store, hash-verified

268}
269
270export function positionToOffset(text: string, line: number, column: number): number {
271 let offset = 0;
272 const lines = text.split('\n');
273 for (let l = 1; l < line; ++l) offset += lines[l - 1].length + 1;
274 offset += column - 1;
275 return offset;
276}
277
278interface INotNullRange {
279 line: number;

Callers 1

completionsMethod · 0.90

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected