MCPcopy
hub / github.com/microsoft/vscode-js-debug / convert

Method convert

src/common/stringUtils.ts:77–87  ·  view source on GitHub ↗

* Converts from a base 0 line and column to a file offset.

(position: IPosition)

Source from the content-addressed store, hash-verified

75 * Converts from a base 0 line and column to a file offset.
76 */
77 public convert(position: IPosition) {
78 const base0 = position.base0;
79 if (base0.lineNumber > this.lines.length) {
80 return this.source.length;
81 }
82
83 const thisLine = this.lines[base0.lineNumber];
84 const nextLine = this.lines[base0.lineNumber + 1] ?? this.source.length + 1;
85
86 return thisLine + Math.min(nextLine - thisLine - 1, base0.columnNumber);
87 }
88}

Callers 4

gatherFunction · 0.80
getNameFromMappingFunction · 0.80
completionsMethod · 0.80

Calls 1

minMethod · 0.80

Tested by 1

gatherFunction · 0.64