Skip to content

Commit 45ac966

Browse files
authored
Merge pull request #4 from kylebarron/kyle/scroll-down-on-setting-selection
2 parents 4da46bd + 989e8e1 commit 45ac966

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/run-code.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ export function runInferredCodeBlockAndMoveDown(): void {
3131

3232
const endPosition = new Position(expandedCodeRange.end.line + 1, 0);
3333
const newSelection = new Selection(endPosition, endPosition);
34-
textEditor.selections = [newSelection];
34+
setSelection(textEditor, newSelection);
35+
}
36+
37+
/** Set selection in given text editor and scroll down */
38+
function setSelection(textEditor: TextEditor, selection: Selection): void {
39+
textEditor.selections = [selection];
40+
textEditor.revealRange(selection);
3541
}
3642

3743
function _runInferredCodeBlock(textEditor: TextEditor): Range {

0 commit comments

Comments
 (0)