Skip to content

Commit 83fd43e

Browse files
Jack Huangfacebook-github-bot
authored andcommitted
adding option to disable scrolling when opening inset view
Summary: **Context** I notice that sometimes when the inset is on the edge of the screen + when line calculation is wonky and not 100%, opening an inset would scroll the user. I will look at the line adjustment logic again but I think when toggling the inset open in editor, we shouldnt scroll the user. Reviewed By: evangrayk Differential Revision: D74273975 fbshipit-source-id: 466fb3e3254514cd60efb16086ecad2b7b353b54
1 parent 7b681e9 commit 83fd43e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

addons/vscode/extension/openFile.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default function openFile(
2424
line?: number,
2525
preview?: boolean,
2626
onOpened?: (editor: vscode.TextEditor) => void,
27+
disableScroll: boolean = false,
2728
) {
2829
if (repo == null) {
2930
return;
@@ -43,7 +44,7 @@ export default function openFile(
4344
})
4445
.then(
4546
editor => {
46-
if (line != null) {
47+
if (!disableScroll && line != null) {
4748
const lineZeroIndexed = line - 1; // vscode uses 0-indexed line numbers
4849
editor.selections = [new vscode.Selection(lineZeroIndexed, 0, lineZeroIndexed, 0)]; // move cursor to line
4950
editor.revealRange(

0 commit comments

Comments
 (0)