@@ -11,17 +11,12 @@ import * as path from 'path';
1111import * as Telemetry from './telemetry' ;
1212import * as util from './common' ;
1313import * as vscode from 'vscode' ;
14- import * as nls from 'vscode-nls' ;
1514
1615import { CppToolsApi , CppToolsExtension } from 'vscode-cpptools' ;
1716import { PlatformInformation } from './platform' ;
1817import { CppTools1 } from './cppTools1' ;
1918import { CppSettings } from './LanguageServer/settings' ;
2019import { PersistentState } from './LanguageServer/persistentState' ;
21- import { TargetPopulation } from 'vscode-tas-client' ;
22-
23- nls . config ( { messageFormat : nls . MessageFormat . bundle , bundleFormat : nls . BundleFormat . standalone } ) ( ) ;
24- const localize : nls . LocalizeFunc = nls . loadMessageBundle ( ) ;
2520
2621const cppTools : CppTools1 = new CppTools1 ( ) ;
2722let languageServiceDisabled : boolean = false ;
@@ -82,7 +77,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
8277 }
8378 LanguageServer . activate ( ) ;
8479
85- HandleInsidersPrompt ( ) ;
80+ UpdateInsidersAccess ( ) ;
8681
8782 return cppTools ;
8883}
@@ -134,39 +129,20 @@ function sendTelemetry(info: PlatformInformation): void {
134129 Telemetry . logDebuggerEvent ( "acquisition" , telemetryProperties ) ;
135130}
136131
137- export function HandleInsidersPrompt ( ) : void {
138- // Only display this prompt to users who have updateChannel configured for Insiders,
139- // and who are not already configured to receive pre-release extensions.
140-
141- const targetPopulation : TargetPopulation = util . getCppToolsTargetPopulation ( ) ;
142- // Skip the prompt if already using an insiders build of cpptools.
143- if ( targetPopulation === TargetPopulation . Public ) {
144- const settings : CppSettings = new CppSettings ( ) ;
145- const displayedInsidersPrompt : PersistentState < boolean > = new PersistentState < boolean > ( "CPP.displayedInsidersPrompt" , false ) ;
146- // Skip the prompt if updateChannel was not set to Insiders.
147- if ( settings . updateChannel === "Insiders" ) {
148- if ( ! displayedInsidersPrompt . Value ) {
149- displayedInsidersPrompt . Value = true ;
150- const message : string = localize ( 'updateChannel.changed' , "The `C_Cpp.updateChannel` setting is deprecated. Do you want to enable install of pre-releases of the C/C++ extension via the Marketplace?" ) ;
151- const yes : string = localize ( "yes.button" , "Yes" ) ;
152- const no : string = localize ( "no.button" , "No" ) ;
153- vscode . window . showInformationMessage ( message , yes , no ) . then ( ( selection ) => {
154- switch ( selection ) {
155- case yes :
156- vscode . commands . executeCommand ( "workbench.extensions.installExtension" , "ms-vscode.cpptools" , { installPreReleaseVersion : true } ) ;
157- break ;
158- case no :
159- break ;
160- default :
161- break ;
162- }
163- } ) ;
164- }
165- } else {
166- // Reset persistent value, so we prompt again if they switch to "Insiders" again.
167- if ( displayedInsidersPrompt . Value ) {
168- displayedInsidersPrompt . Value = false ;
169- }
132+ export function UpdateInsidersAccess ( ) : void {
133+ // Only move them to the new prerelease mechanism if using updateChannel of Insiders.
134+ const settings : CppSettings = new CppSettings ( ) ;
135+ const migratedInsiders : PersistentState < boolean > = new PersistentState < boolean > ( "CPP.migratedInsiders" , false ) ;
136+ if ( settings . updateChannel === "Insiders" ) {
137+ // Don't do anything while the user has autoUpdate disabled, so we do not cause the extension to be updated.
138+ if ( ! migratedInsiders . Value && vscode . workspace . getConfiguration ( "extensions" , null ) . get < boolean > ( "autoUpdate" ) ) {
139+ migratedInsiders . Value = true ;
140+ vscode . commands . executeCommand ( "workbench.extensions.installExtension" , "ms-vscode.cpptools" , { installPreReleaseVersion : true } ) ;
141+ }
142+ } else {
143+ // Reset persistent value, so we register again if they switch to "Insiders" again.
144+ if ( migratedInsiders . Value ) {
145+ migratedInsiders . Value = false ;
170146 }
171147 }
172148}
0 commit comments