Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1188,10 +1188,13 @@ export function registerCommands(
const document = await vscode.workspace.openTextDocument(item.fileUri);
const editor = await vscode.window.showTextDocument(document);

const position = new vscode.Position(
// Clamp to the document's current bounds: the file may have been
// edited (lines removed) since the bookmark was created, which would
// otherwise leave selection/reveal operating on an invalid position.
const position = document.validatePosition(new vscode.Position(
item.bookmark.line,
item.bookmark.character || 0
);
));

const range = new vscode.Range(position, position);

Expand Down
Loading