@@ -7,8 +7,8 @@ import { CancellationToken } from 'vs/base/common/cancellation';
77import { DisposableStore } from 'vs/base/common/lifecycle' ;
88import { joinPath } from 'vs/base/common/resources' ;
99import { localize } from 'vs/nls' ;
10- import { Action2 , registerAction2 } from 'vs/platform/actions/common/actions' ;
11- import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs' ;
10+ import { Action2 , MenuId , registerAction2 } from 'vs/platform/actions/common/actions' ;
11+ import { IDialogService , IFileDialogService } from 'vs/platform/dialogs/common/dialogs' ;
1212import { IFileService } from 'vs/platform/files/common/files' ;
1313import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
1414import { INotificationService } from 'vs/platform/notification/common/notification' ;
@@ -19,6 +19,7 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
1919import { IUserDataProfile , IUserDataProfilesService } from 'vs/platform/userDataProfile/common/userDataProfile' ;
2020import { CATEGORIES } from 'vs/workbench/common/actions' ;
2121import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity' ;
22+ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey' ;
2223
2324registerAction2 ( class CreateFromCurrentProfileAction extends Action2 {
2425 constructor ( ) {
@@ -196,14 +197,14 @@ registerAction2(class ExportProfileAction extends Action2 {
196197 original : 'Export Settings Profile...'
197198 } ,
198199 category : PROFILES_CATEGORY ,
199- f1 : true ,
200- precondition : PROFILES_ENABLEMENT_CONTEXT ,
201200 menu : [
202201 {
203202 id : ManageProfilesSubMenu ,
204203 group : '3_import_export_profiles' ,
205204 when : PROFILES_ENABLEMENT_CONTEXT ,
206205 order : 1
206+ } , {
207+ id : MenuId . CommandPalette
207208 }
208209 ]
209210 } ) ;
@@ -241,14 +242,14 @@ registerAction2(class ImportProfileAction extends Action2 {
241242 original : 'Import Settings Profile...'
242243 } ,
243244 category : PROFILES_CATEGORY ,
244- f1 : true ,
245- precondition : PROFILES_ENABLEMENT_CONTEXT ,
246245 menu : [
247246 {
248247 id : ManageProfilesSubMenu ,
249248 group : '3_import_export_profiles' ,
250249 when : PROFILES_ENABLEMENT_CONTEXT ,
251250 order : 2
251+ } , {
252+ id : MenuId . CommandPalette
252253 }
253254 ]
254255 } ) ;
@@ -260,6 +261,19 @@ registerAction2(class ImportProfileAction extends Action2 {
260261 const fileService = accessor . get ( IFileService ) ;
261262 const requestService = accessor . get ( IRequestService ) ;
262263 const userDataProfileImportExportService = accessor . get ( IUserDataProfileImportExportService ) ;
264+ const dialogService = accessor . get ( IDialogService ) ;
265+ const contextKeyService = accessor . get ( IContextKeyService ) ;
266+
267+ const isSettingProfilesEnabled = contextKeyService . contextMatchesRules ( PROFILES_ENABLEMENT_CONTEXT ) ;
268+
269+ if ( ! isSettingProfilesEnabled ) {
270+ if ( ! ( await dialogService . confirm ( {
271+ title : localize ( 'import profile title' , "Import Settings from a Profile" ) ,
272+ message : localize ( 'confiirmation message' , "This will replace your current settings. Are you sure you want to continue?" ) ,
273+ } ) ) . confirmed ) {
274+ return ;
275+ }
276+ }
263277
264278 const disposables = new DisposableStore ( ) ;
265279 const quickPick = disposables . add ( quickInputService . createQuickPick ( ) ) ;
@@ -278,7 +292,11 @@ registerAction2(class ImportProfileAction extends Action2 {
278292 quickPick . hide ( ) ;
279293 const profile = quickPick . selectedItems [ 0 ] . description ? await this . getProfileFromURL ( quickPick . value , requestService ) : await this . getProfileFromFileSystem ( fileDialogService , fileService ) ;
280294 if ( profile ) {
281- await userDataProfileImportExportService . importProfile ( profile ) ;
295+ if ( isSettingProfilesEnabled ) {
296+ await userDataProfileImportExportService . importProfile ( profile ) ;
297+ } else {
298+ await userDataProfileImportExportService . setProfile ( profile ) ;
299+ }
282300 }
283301 } ) ) ;
284302 disposables . add ( quickPick . onDidHide ( ( ) => disposables . dispose ( ) ) ) ;
0 commit comments