Skip to content

Commit

Permalink
Reveal in center after goto
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricedb committed Oct 19, 2020
1 parent fecff6f commit edef925
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/instruction-handlers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
import { commands, Position, Selection, Uri, window, workspace } from 'vscode';
import {
commands,
Position,
Selection,
TextEditorRevealType,
Uri,
window,
workspace,
} from 'vscode';
import { join, dirname } from 'path';

import {
Expand Down Expand Up @@ -122,7 +130,11 @@ export const goto = async (instruction: GoTo): Promise<void> => {

const position = new Position(line - 1, column - 1);
editor.selection = new Selection(position, position);
editor.revealRange(editor.selection);
editor.revealRange(
editor.selection,
TextEditorRevealType.InCenterIfOutsideViewport
);

await timeout(getDelay());
};

Expand Down

0 comments on commit edef925

Please sign in to comment.