Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only show terminal notification for basic terminals created using '+' icon #22275

Merged
merged 6 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export namespace Interpreters {
export const activatingTerminals = l10n.t('Reactivating terminals...');
export const activateTerminalDescription = l10n.t('Activated environment for');
export const terminalEnvVarCollectionPrompt = l10n.t(
'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).',
'The selected Python environment indicator{0} may not be present in the terminal prompt. Rest assured, all terminals are still activated. [Learn more](https://aka.ms/vscodePythonTerminalActivation).',
);
export const terminalDeactivateProgress = l10n.t('Editing {0}...');
export const restartingTerminal = l10n.t('Restarting terminal and deactivating...');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class TerminalDeactivateLimitationPrompt implements IExtensionSingleActiv
}
if (!isTestExecution()) {
// Avoid showing prompt until startup completes.
await sleep(5000);
await sleep(6000);
}
this.disposableRegistry.push(
this.appShell.onDidWriteTerminalData(async (e) => {
Expand Down
17 changes: 12 additions & 5 deletions src/client/terminals/envCollectionActivation/indicatorPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,17 @@ export class TerminalIndicatorPrompt implements IExtensionSingleActivationServic
}
if (!isTestExecution()) {
// Avoid showing prompt until startup completes.
await sleep(5000);
await sleep(6000);
}
this.disposableRegistry.push(
this.terminalManager.onDidOpenTerminal(async (terminal) => {
const hideFromUser =
'hideFromUser' in terminal.creationOptions && terminal.creationOptions.hideFromUser;
const strictEnv = 'strictEnv' in terminal.creationOptions && terminal.creationOptions.strictEnv;
if (hideFromUser || strictEnv || terminal.creationOptions.name) {
// Only show this notification for basic terminals created using the '+' button.
return;
}
const cwd =
'cwd' in terminal.creationOptions && terminal.creationOptions.cwd
? terminal.creationOptions.cwd
Expand Down Expand Up @@ -78,6 +85,9 @@ export class TerminalIndicatorPrompt implements IExtensionSingleActivationServic
}
const prompts = [Common.doNotShowAgain];
const interpreter = await this.interpreterService.getActiveInterpreter(resource);
if (!interpreter) {
return;
}
const terminalPromptName = getPromptName(interpreter);
const selection = await this.appShell.showInformationMessage(
Interpreters.terminalEnvVarCollectionPrompt.format(terminalPromptName),
Expand All @@ -92,10 +102,7 @@ export class TerminalIndicatorPrompt implements IExtensionSingleActivationServic
}
}

function getPromptName(interpreter?: PythonEnvironment) {
if (!interpreter) {
return '';
}
function getPromptName(interpreter: PythonEnvironment) {
if (interpreter.envName) {
return `, ${l10n.t('i.e')} "(${interpreter.envName})"`;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { TensorboardExperiment } from '../../client/tensorBoard/tensorboarExperi

[true, false].forEach((tbExtensionInstalled) => {
suite(`Tensorboard Extension is ${tbExtensionInstalled ? 'installed' : 'not installed'}`, () => {
suite.only('TensorBoard nbextension code lens provider', () => {
suite('TensorBoard nbextension code lens provider', () => {
let experiment: TensorboardExperiment;
let codeLensProvider: TensorBoardNbextensionCodeLensProvider;
let cancelTokenSource: CancellationTokenSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { TensorboardExperiment } from '../../client/tensorBoard/tensorboarExperi

[true, false].forEach((tbExtensionInstalled) => {
suite(`Tensorboard Extension is ${tbExtensionInstalled ? 'installed' : 'not installed'}`, () => {
suite.only('TensorBoard import code lens provider', () => {
suite('TensorBoard import code lens provider', () => {
let experiment: TensorboardExperiment;
let codeLensProvider: TensorBoardImportCodeLensProvider;
let cancelTokenSource: CancellationTokenSource;
Expand Down
2 changes: 1 addition & 1 deletion src/test/tensorBoard/tensorBoardPrompt.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Common } from '../../client/common/utils/localize';
import { TensorBoardEntrypointTrigger } from '../../client/tensorBoard/constants';
import { TensorBoardPrompt } from '../../client/tensorBoard/tensorBoardPrompt';

suite.only('TensorBoard prompt', () => {
suite('TensorBoard prompt', () => {
let applicationShell: ApplicationShell;
let commandManager: CommandManager;
let persistentState: PersistentState<boolean>;
Expand Down
2 changes: 1 addition & 1 deletion src/test/tensorBoard/tensorBoardUsageTracker.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { TensorboardExperiment } from '../../client/tensorBoard/tensorboarExperi

[true, false].forEach((tbExtensionInstalled) => {
suite(`Tensorboard Extension is ${tbExtensionInstalled ? 'installed' : 'not installed'}`, () => {
suite.only('TensorBoard usage tracker', () => {
suite('TensorBoard usage tracker', () => {
let experiment: TensorboardExperiment;
let documentManager: MockDocumentManager;
let tensorBoardImportTracker: TensorBoardUsageTracker;
Expand Down
Loading