Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/commands.ts')
-rw-r--r--editors/code/src/commands.ts14
1 files changed, 4 insertions, 10 deletions
diff --git a/editors/code/src/commands.ts b/editors/code/src/commands.ts
index b3aa04af7e..eee623ecae 100644
--- a/editors/code/src/commands.ts
+++ b/editors/code/src/commands.ts
@@ -361,10 +361,7 @@ export function syntaxTreeReveal(): Cmd {
const activeEditor = vscode.window.activeTextEditor;
if (activeEditor !== undefined) {
- const start = activeEditor.document.positionAt(element.start);
- const end = activeEditor.document.positionAt(element.end);
-
- const newSelection = new vscode.Selection(start, end);
+ const newSelection = new vscode.Selection(element.range.start, element.range.end);
activeEditor.selection = newSelection;
activeEditor.revealRange(newSelection);
@@ -378,15 +375,12 @@ function elementToString(
depth: number = 0,
): string {
let result = " ".repeat(depth);
- const start = element.istart ?? element.start;
- const end = element.iend ?? element.end;
+ const offsets = element.inner?.offsets ?? element.offsets;
- result += `${element.kind}@${start}..${end}`;
+ result += `${element.kind}@${offsets.start}..${offsets.end}`;
if (element.type === "Token") {
- const startPosition = activeDocument.positionAt(element.start);
- const endPosition = activeDocument.positionAt(element.end);
- const text = activeDocument.getText(new vscode.Range(startPosition, endPosition));
+ const text = activeDocument.getText(element.range).replaceAll("\r\n", "\n");
// JSON.stringify quotes and escapes the string for us.
result += ` ${JSON.stringify(text)}\n`;
} else {