Skip to content

Commit 0b84741

Browse files
committed
create common string for don't ask again
1 parent ac0c93c commit 0b84741

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

src/common/localize.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export namespace Common {
1515
export const ok = l10n.t('Ok');
1616
export const quickCreate = l10n.t('Quick Create');
1717
export const installPython = l10n.t('Install Python');
18+
export const dontAskAgain = l10n.t("Don't ask again");
1819
}
1920

2021
export namespace WorkbenchStrings {
@@ -141,7 +142,6 @@ export namespace PixiStrings {
141142
'Pixi environments were detected. Install the Pixi extension for full support including activation and environment management.',
142143
);
143144
export const install = l10n.t('Install Pixi Extension');
144-
export const dontAskAgain = l10n.t("Don't Ask Again");
145145
}
146146

147147
export namespace CondaStrings {
@@ -248,7 +248,6 @@ export namespace UvInstallStrings {
248248
export const uvInstallRestartRequired = l10n.t(
249249
'uv was installed but may not be available in the current terminal. Please restart VS Code or open a new terminal and try again.',
250250
);
251-
export const dontAskAgain = l10n.t("Don't ask again");
252251
export const clickToInstallPython = l10n.t('No Python found, click to install');
253252
export const selectPythonVersion = l10n.t('Select Python version to install');
254253
export const installed = l10n.t('installed');

src/managers/builtin/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '../../api';
1111
import { showErrorMessageWithLogs } from '../../common/errors/utils';
1212
import { getExtension } from '../../common/extension.apis';
13-
import { PixiStrings, SysManagerStrings } from '../../common/localize';
13+
import { Common, PixiStrings, SysManagerStrings } from '../../common/localize';
1414
import { traceInfo, traceVerbose } from '../../common/logging';
1515
import { getGlobalPersistentState } from '../../common/persistentState';
1616
import { showInformationMessage, withProgress } from '../../common/window.apis';
@@ -126,13 +126,13 @@ async function recommendPixiExtension(): Promise<void> {
126126
const result = await showInformationMessage(
127127
PixiStrings.pixiExtensionRecommendation,
128128
PixiStrings.install,
129-
PixiStrings.dontAskAgain,
129+
Common.dontAskAgain,
130130
);
131131

132132
if (result === PixiStrings.install) {
133133
traceInfo(`Installing extension: ${PIXI_EXTENSION_ID}`);
134134
await installExtension(PIXI_EXTENSION_ID);
135-
} else if (result === PixiStrings.dontAskAgain) {
135+
} else if (result === Common.dontAskAgain) {
136136
await state.set(PIXI_RECOMMEND_DONT_ASK_KEY, true);
137137
traceInfo('User selected "Don\'t ask again" for Pixi extension recommendation');
138138
}

src/managers/builtin/uvPythonInstaller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
TaskScope,
1010
} from 'vscode';
1111
import { spawnProcess } from '../../common/childProcess.apis';
12-
import { UvInstallStrings } from '../../common/localize';
12+
import { Common, UvInstallStrings } from '../../common/localize';
1313
import { traceError, traceInfo, traceLog } from '../../common/logging';
1414
import { getGlobalPersistentState } from '../../common/persistentState';
1515
import { executeTask, onDidEndTaskProcess } from '../../common/tasks.apis';
@@ -350,10 +350,10 @@ export async function promptInstallPythonViaUv(
350350
promptMessage,
351351
{ modal: true },
352352
UvInstallStrings.installPython,
353-
UvInstallStrings.dontAskAgain,
353+
Common.dontAskAgain,
354354
);
355355

356-
if (result === UvInstallStrings.dontAskAgain) {
356+
if (result === Common.dontAskAgain) {
357357
await state.set(UV_INSTALL_PYTHON_DONT_ASK_KEY, true);
358358
traceLog('User selected "Don\'t ask again" for Python install prompt');
359359
return undefined;

src/test/managers/builtin/uvPythonInstaller.unit.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import assert from 'assert';
22
import * as sinon from 'sinon';
33
import { LogOutputChannel } from 'vscode';
44
import * as childProcessApis from '../../../common/childProcess.apis';
5-
import { UvInstallStrings } from '../../../common/localize';
5+
import { Common, UvInstallStrings } from '../../../common/localize';
66
import * as persistentState from '../../../common/persistentState';
77
import { EventNames } from '../../../common/telemetry/constants';
88
import * as telemetrySender from '../../../common/telemetry/sender';
@@ -67,7 +67,7 @@ suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
6767
UvInstallStrings.installPythonPrompt,
6868
{ modal: true },
6969
UvInstallStrings.installPython,
70-
UvInstallStrings.dontAskAgain,
70+
Common.dontAskAgain,
7171
),
7272
'Should show install Python prompt when uv is installed',
7373
);
@@ -85,7 +85,7 @@ suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
8585
UvInstallStrings.installPythonAndUvPrompt,
8686
{ modal: true },
8787
UvInstallStrings.installPython,
88-
UvInstallStrings.dontAskAgain,
88+
Common.dontAskAgain,
8989
),
9090
'Should show install Python AND uv prompt when uv is not installed',
9191
);
@@ -94,7 +94,7 @@ suite('uvPythonInstaller - promptInstallPythonViaUv', () => {
9494
test('should set persistent state when user clicks "Don\'t ask again"', async () => {
9595
mockState.get.resolves(false);
9696
isUvInstalledStub.resolves(true);
97-
showInformationMessageStub.resolves(UvInstallStrings.dontAskAgain);
97+
showInformationMessageStub.resolves(Common.dontAskAgain);
9898

9999
const result = await promptInstallPythonViaUv('activation', mockLog);
100100

0 commit comments

Comments
 (0)