Skip to content

Commit 802cf0c

Browse files
author
Kartik Raj
authored
Reveal selection after editing deactivate script (microsoft#22271)
1 parent 6333752 commit 802cf0c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/client/terminals/envCollectionActivation/deactivatePrompt.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
// Licensed under the MIT License.
33

44
import { inject, injectable } from 'inversify';
5-
import { Position, Uri, WorkspaceEdit, Range, TextEditorRevealType, ProgressLocation, Terminal } from 'vscode';
5+
import {
6+
Position,
7+
Uri,
8+
WorkspaceEdit,
9+
Range,
10+
TextEditorRevealType,
11+
ProgressLocation,
12+
Terminal,
13+
Selection,
14+
} from 'vscode';
615
import {
716
IApplicationEnvironment,
817
IApplicationShell,
@@ -141,12 +150,17 @@ ${content}
141150
// If script already has the hook, don't add it again.
142151
const editor = await this.documentManager.showTextDocument(document);
143152
if (document.getText().includes(hookMarker)) {
153+
editor.revealRange(
154+
new Range(new Position(document.lineCount - 3, 0), new Position(document.lineCount, 0)),
155+
TextEditorRevealType.AtTop,
156+
);
144157
return;
145158
}
146159
const editorEdit = new WorkspaceEdit();
147160
editorEdit.insert(document.uri, new Position(document.lineCount, 0), content);
148161
await this.documentManager.applyEdit(editorEdit);
149162
// Reveal the edits.
163+
editor.selection = new Selection(new Position(document.lineCount - 3, 0), new Position(document.lineCount, 0));
150164
editor.revealRange(
151165
new Range(new Position(document.lineCount - 3, 0), new Position(document.lineCount, 0)),
152166
TextEditorRevealType.AtTop,

0 commit comments

Comments
 (0)