Skip to content

Commit 937ed9a

Browse files
committed
Show both stable and pre-release options.
1 parent ec0baf8 commit 937ed9a

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

package.nls.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@
216216
"TensorBoard.enterRemoteUrl": "Enter remote URL",
217217
"TensorBoard.enterRemoteUrlDetail": "Enter a URL pointing to a remote directory containing your TensorBoard log files",
218218
"SwitchToDefaultLS.bannerMessage": "The Microsoft Python Language Server has reached end of life. Your language server has been set to the default for Python in VS Code, Pylance. If you’d like to change your language server, you can learn about how to do so [here](https://devblogs.microsoft.com/python/python-in-visual-studio-code-may-2021-release/#configuring-your-language-server). Read Pylance’s license [here](https://marketplace.visualstudio.com/items/ms-python.vscode-pylance/license).",
219-
"SwitchToPrereleaseExtension.bannerMessage": "We now have a new mechanism to get pre-release (insiders) version of the extension. See [here](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions) to lean more.",
220-
"SwitchToPrereleaseExtension.installPreRelease": "Install Pre-Release"
219+
"SwitchToPrereleaseExtension.bannerMessage": "We now have a new way to get pre-release (insiders) version of the extension. See [here](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions) to lean more.",
220+
"SwitchToPrereleaseExtension.installPreRelease": "Install Pre-Release",
221+
"SwitchToPrereleaseExtension.installStable": "Install Stable"
221222
}

src/client/application/diagnostics/checks/switchToPreReleaseExtension.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -83,24 +83,29 @@ export class SwitchToPreReleaseExtensionDiagnosticService extends BaseDiagnostic
8383
prompt: SwitchToPrereleaseExtension.installPreRelease(),
8484
command: {
8585
diagnostic,
86-
invoke: async (): Promise<void> => {
87-
sendTelemetryEvent(EventName.INSIDERS_PROMPT, undefined, { selection: 'preRelease' });
88-
const config = this.workspaceService.getConfiguration('python', diagnostic.resource);
89-
const value = config.inspect<string>('insidersChannel');
90-
if (value) {
91-
config.update('insidersChannel', undefined, ConfigurationTarget.Global);
92-
}
93-
await this.commandManager.executeCommand(
94-
`workbench.extensions.installExtension`,
95-
PVSC_EXTENSION_ID,
96-
{
97-
installPreReleaseVersion: true,
98-
},
99-
);
100-
},
86+
invoke: (): Promise<void> => this.installExtension(true, diagnostic.resource),
87+
},
88+
},
89+
{
90+
prompt: SwitchToPrereleaseExtension.installStable(),
91+
command: {
92+
diagnostic,
93+
invoke: (): Promise<void> => this.installExtension(false, diagnostic.resource),
10194
},
10295
},
10396
],
10497
});
10598
}
99+
100+
private async installExtension(preRelease: boolean, resource: Resource): Promise<void> {
101+
sendTelemetryEvent(EventName.INSIDERS_PROMPT, undefined, { selection: preRelease ? 'preRelease' : 'stable' });
102+
const config = this.workspaceService.getConfiguration('python', resource);
103+
const setting = config.inspect<string>('insidersChannel');
104+
if (setting) {
105+
config.update('insidersChannel', undefined, ConfigurationTarget.Global);
106+
}
107+
await this.commandManager.executeCommand(`workbench.extensions.installExtension`, PVSC_EXTENSION_ID, {
108+
installPreReleaseVersion: preRelease,
109+
});
110+
}
106111
}

src/client/common/utils/localize.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,10 @@ export namespace SwitchToDefaultLS {
537537
export namespace SwitchToPrereleaseExtension {
538538
export const bannerMessage = localize(
539539
'SwitchToPrereleaseExtension.bannerMessage',
540-
'We now have a new mechanism to get pre-release (insiders) version of the extension. See [here](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions) to lean more.',
540+
'We now have a new way to get pre-release (insiders) version of the extension. See [here](https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions) to lean more.',
541541
);
542542
export const installPreRelease = localize('SwitchToPrereleaseExtension.installPreRelease', 'Install Pre-Release');
543+
export const installStable = localize('SwitchToPrereleaseExtension.installStable', 'Install Stable');
543544
}
544545

545546
function localize(key: string, defValue?: string) {

src/client/telemetry/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ export interface IEventNamePropertyMapping {
13741374
* `Yes, daily` When user selects to use "daily" as extension channel in insiders prompt
13751375
* `No, thanks` When user decides to keep using the same extension channel as before
13761376
*/
1377-
selection: 'preRelease' | 'closed' | undefined;
1377+
selection: 'preRelease' | 'stable' | 'closed' | undefined;
13781378
};
13791379
/**
13801380
* Telemetry event sent with details when user clicks a button in the 'Reload to install insiders prompt'.

0 commit comments

Comments
 (0)