Skip to content

Commit 514bce6

Browse files
author
Kartik Raj
authored
Revert "Show notification when deactivate command is run in terminal" (#22158)
Reverts #22133
1 parent 66cea21 commit 514bce6

File tree

18 files changed

+45
-490
lines changed

18 files changed

+45
-490
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
"quickPickSortByLabel",
2323
"testObserver",
2424
"quickPickItemTooltip",
25-
"saveEditor",
26-
"terminalDataWriteEvent"
25+
"saveEditor"
2726
],
2827
"author": {
2928
"name": "Microsoft Corporation"

src/client/common/application/applicationShell.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
DocumentSelector,
1111
env,
1212
Event,
13-
EventEmitter,
1413
InputBox,
1514
InputBoxOptions,
1615
languages,
@@ -38,8 +37,7 @@ import {
3837
WorkspaceFolder,
3938
WorkspaceFolderPickOptions,
4039
} from 'vscode';
41-
import { traceError } from '../../logging';
42-
import { IApplicationShell, TerminalDataWriteEvent } from './types';
40+
import { IApplicationShell } from './types';
4341

4442
@injectable()
4543
export class ApplicationShell implements IApplicationShell {
@@ -174,12 +172,4 @@ export class ApplicationShell implements IApplicationShell {
174172
public createLanguageStatusItem(id: string, selector: DocumentSelector): LanguageStatusItem {
175173
return languages.createLanguageStatusItem(id, selector);
176174
}
177-
public get onDidWriteTerminalData(): Event<TerminalDataWriteEvent> {
178-
try {
179-
return window.onDidWriteTerminalData;
180-
} catch (ex) {
181-
traceError('Failed to get proposed API onDidWriteTerminalData', ex);
182-
return new EventEmitter<TerminalDataWriteEvent>().event;
183-
}
184-
}
185175
}

src/client/common/application/types.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,6 @@ import { Resource } from '../types';
6767
import { ICommandNameArgumentTypeMapping } from './commands';
6868
import { ExtensionContextKey } from './contextKeys';
6969

70-
export interface TerminalDataWriteEvent {
71-
/**
72-
* The {@link Terminal} for which the data was written.
73-
*/
74-
readonly terminal: Terminal;
75-
/**
76-
* The data being written.
77-
*/
78-
readonly data: string;
79-
}
80-
8170
export const IApplicationShell = Symbol('IApplicationShell');
8271
export interface IApplicationShell {
8372
/**
@@ -86,13 +75,6 @@ export interface IApplicationShell {
8675
*/
8776
readonly onDidChangeWindowState: Event<WindowState>;
8877

89-
/**
90-
* An event which fires when the terminal's child pseudo-device is written to (the shell).
91-
* In other words, this provides access to the raw data stream from the process running
92-
* within the terminal, including VT sequences.
93-
*/
94-
readonly onDidWriteTerminalData: Event<TerminalDataWriteEvent>;
95-
9678
showInformationMessage(message: string, ...items: string[]): Thenable<string | undefined>;
9779

9880
/**

src/client/common/utils/localize.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ export namespace Interpreters {
201201
export const terminalEnvVarCollectionPrompt = l10n.t(
202202
'The Python extension automatically activates all terminals using the selected environment, even when the name of the environment{0} is not present in the terminal prompt. [Learn more](https://aka.ms/vscodePythonTerminalActivation).',
203203
);
204-
export const terminalDeactivatePrompt = l10n.t(
205-
'Deactivating virtual environments may not work by default due to a technical limitation in our activation approach, but it can be resolved with a few simple steps.',
206-
);
207-
export const deactivateDoneButton = l10n.t('Done, it works');
208204
export const activatedCondaEnvLaunch = l10n.t(
209205
'We noticed VS Code was launched from an activated conda environment, would you like to select it?',
210206
);

src/client/terminals/envCollectionActivation/indicatorPrompt.ts renamed to src/client/interpreter/activation/terminalEnvVarCollectionPrompt.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ import {
1414
} from '../../common/types';
1515
import { Common, Interpreters } from '../../common/utils/localize';
1616
import { IExtensionSingleActivationService } from '../../activation/types';
17+
import { ITerminalEnvVarCollectionService } from './types';
1718
import { inTerminalEnvVarExperiment } from '../../common/experiments/helpers';
18-
import { IInterpreterService } from '../../interpreter/contracts';
19+
import { IInterpreterService } from '../contracts';
1920
import { PythonEnvironment } from '../../pythonEnvironments/info';
20-
import { ITerminalEnvVarCollectionService } from '../types';
2121

2222
export const terminalEnvCollectionPromptKey = 'TERMINAL_ENV_COLLECTION_PROMPT_KEY';
2323

2424
@injectable()
25-
export class TerminalIndicatorPrompt implements IExtensionSingleActivationService {
25+
export class TerminalEnvVarCollectionPrompt implements IExtensionSingleActivationService {
2626
public readonly supportedWorkspaceTypes = { untrustedWorkspace: false, virtualWorkspace: false };
2727

2828
constructor(

src/client/terminals/envCollectionActivation/service.ts renamed to src/client/interpreter/activation/terminalEnvVarCollectionService.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,16 @@ import {
2828
import { Deferred, createDeferred } from '../../common/utils/async';
2929
import { Interpreters } from '../../common/utils/localize';
3030
import { traceDecoratorVerbose, traceError, traceVerbose, traceWarn } from '../../logging';
31-
import { IInterpreterService } from '../../interpreter/contracts';
32-
import { defaultShells } from '../../interpreter/activation/service';
33-
import { IEnvironmentActivationService } from '../../interpreter/activation/types';
31+
import { IInterpreterService } from '../contracts';
32+
import { defaultShells } from './service';
33+
import { IEnvironmentActivationService, ITerminalEnvVarCollectionService } from './types';
3434
import { EnvironmentType, PythonEnvironment } from '../../pythonEnvironments/info';
3535
import { getSearchPathEnvVarNames } from '../../common/utils/exec';
3636
import { EnvironmentVariables } from '../../common/variables/types';
3737
import { TerminalShellType } from '../../common/terminal/types';
3838
import { OSType } from '../../common/utils/platform';
3939
import { normCase } from '../../common/platform/fs-paths';
4040
import { PythonEnvType } from '../../pythonEnvironments/base/info';
41-
import { ITerminalEnvVarCollectionService } from '../types';
4241

4342
@injectable()
4443
export class TerminalEnvVarCollectionService implements IExtensionActivationService, ITerminalEnvVarCollectionService {

src/client/interpreter/activation/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,11 @@ export interface IEnvironmentActivationService {
2121
interpreter?: PythonEnvironment,
2222
): Promise<string[] | undefined>;
2323
}
24+
25+
export const ITerminalEnvVarCollectionService = Symbol('ITerminalEnvVarCollectionService');
26+
export interface ITerminalEnvVarCollectionService {
27+
/**
28+
* Returns true if we know with high certainity the terminal prompt is set correctly for a particular resource.
29+
*/
30+
isTerminalPromptSetCorrectly(resource?: Resource): boolean;
31+
}

src/client/interpreter/serviceRegistry.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
import { IExtensionActivationService, IExtensionSingleActivationService } from '../activation/types';
77
import { IServiceManager } from '../ioc/types';
88
import { EnvironmentActivationService } from './activation/service';
9-
import { IEnvironmentActivationService } from './activation/types';
9+
import { TerminalEnvVarCollectionPrompt } from './activation/terminalEnvVarCollectionPrompt';
10+
import { TerminalEnvVarCollectionService } from './activation/terminalEnvVarCollectionService';
11+
import { IEnvironmentActivationService, ITerminalEnvVarCollectionService } from './activation/types';
1012
import { InterpreterAutoSelectionService } from './autoSelection/index';
1113
import { InterpreterAutoSelectionProxyService } from './autoSelection/proxy';
1214
import { IInterpreterAutoSelectionService, IInterpreterAutoSelectionProxyService } from './autoSelection/types';
@@ -108,4 +110,13 @@ export function registerTypes(serviceManager: IServiceManager): void {
108110
IEnvironmentActivationService,
109111
EnvironmentActivationService,
110112
);
113+
serviceManager.addSingleton<ITerminalEnvVarCollectionService>(
114+
ITerminalEnvVarCollectionService,
115+
TerminalEnvVarCollectionService,
116+
);
117+
serviceManager.addBinding(ITerminalEnvVarCollectionService, IExtensionActivationService);
118+
serviceManager.addSingleton<IExtensionSingleActivationService>(
119+
IExtensionSingleActivationService,
120+
TerminalEnvVarCollectionPrompt,
121+
);
111122
}

src/client/telemetry/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export enum EventName {
2929
TERMINAL_SHELL_IDENTIFICATION = 'TERMINAL_SHELL_IDENTIFICATION',
3030
PYTHON_INTERPRETER_ACTIVATE_ENVIRONMENT_PROMPT = 'PYTHON_INTERPRETER_ACTIVATE_ENVIRONMENT_PROMPT',
3131
PYTHON_NOT_INSTALLED_PROMPT = 'PYTHON_NOT_INSTALLED_PROMPT',
32-
TERMINAL_DEACTIVATE_PROMPT = 'TERMINAL_DEACTIVATE_PROMPT',
3332
CONDA_INHERIT_ENV_PROMPT = 'CONDA_INHERIT_ENV_PROMPT',
3433
REQUIRE_JUPYTER_PROMPT = 'REQUIRE_JUPYTER_PROMPT',
3534
ACTIVATED_CONDA_ENV_LAUNCH = 'ACTIVATED_CONDA_ENV_LAUNCH',

src/client/telemetry/index.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,24 +1328,6 @@ export interface IEventNamePropertyMapping {
13281328
*/
13291329
selection: 'Allow' | 'Close' | undefined;
13301330
};
1331-
/**
1332-
* Telemetry event sent with details when user clicks the prompt with the following message:
1333-
*
1334-
* 'Deactivating virtual environments may not work by default due to a technical limitation in our activation approach, but it can be resolved with a few simple steps.'
1335-
*/
1336-
/* __GDPR__
1337-
"terminal_deactivate_prompt" : {
1338-
"selection" : { "classification": "SystemMetaData", "purpose": "FeatureInsight", "owner": "karrtikr" }
1339-
}
1340-
*/
1341-
[EventName.TERMINAL_DEACTIVATE_PROMPT]: {
1342-
/**
1343-
* `See Instructions` When 'See Instructions' option is selected
1344-
* `Done, it works` When 'Done, it works' option is selected
1345-
* `Don't show again` When 'Don't show again' option is selected
1346-
*/
1347-
selection: 'See Instructions' | 'Done, it works' | "Don't show again" | undefined;
1348-
};
13491331
/**
13501332
* Telemetry event sent with details when user attempts to run in interactive window when Jupyter is not installed.
13511333
*/

0 commit comments

Comments
 (0)