Skip to content

Commit fd54668

Browse files
Merge pull request #658 from ty-d/LinkRevealRange
Use reveal range instead of moving the cursor
2 parents 16017b2 + 3726851 commit fd54668

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/providers/DocumentLinkProvider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ export class DocumentLinkProvider implements vscode.DocumentLinkProvider {
6464
offset += method.location.range.start.line + 1;
6565
}
6666

67-
// move the cursor
68-
const cursor = editor.selection.active;
69-
const newPosition = cursor.with(offset, 0);
70-
editor.selection = new vscode.Selection(newPosition, newPosition);
67+
const line = editor.document.lineAt(offset);
68+
const range = new vscode.Range(line.range.start, line.range.start);
69+
editor.selection = new vscode.Selection(range.start, range.start);
70+
editor.revealRange(range, vscode.TextEditorRevealType.InCenter);
7171

7272
return new vscode.DocumentLink(link.range, link.uri);
7373
}

0 commit comments

Comments
 (0)