@@ -14,11 +14,11 @@ import { EnablementState, IExtensionManagementServerService, IPublisherInfo, IWo
14
14
import { IExtensionIgnoredRecommendationsService , IExtensionRecommendationsService } from '../../../services/extensionRecommendations/common/extensionRecommendations.js' ;
15
15
import { IWorkbenchContributionsRegistry , Extensions as WorkbenchExtensions , IWorkbenchContribution , registerWorkbenchContribution2 , WorkbenchPhase } from '../../../common/contributions.js' ;
16
16
import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js' ;
17
- import { VIEWLET_ID , IExtensionsWorkbenchService , IExtensionsViewPaneContainer , TOGGLE_IGNORE_EXTENSION_ACTION_ID , INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID , WORKSPACE_RECOMMENDATIONS_VIEW_ID , IWorkspaceRecommendedExtensionsView , AutoUpdateConfigurationKey , HasOutdatedExtensionsContext , SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID , LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID , ExtensionEditorTab , THEME_ACTIONS_GROUP , INSTALL_ACTIONS_GROUP , OUTDATED_EXTENSIONS_VIEW_ID , CONTEXT_HAS_GALLERY , extensionsSearchActionsMenu , UPDATE_ACTIONS_GROUP , IExtensionArg , ExtensionRuntimeActionType , EXTENSIONS_CATEGORY , AutoRestartConfigurationKey , extensionsFilterSubMenu , DefaultViewsContext } from '../common/extensions.js' ;
17
+ import { VIEWLET_ID , IExtensionsWorkbenchService , IExtensionsViewPaneContainer , TOGGLE_IGNORE_EXTENSION_ACTION_ID , INSTALL_EXTENSION_FROM_VSIX_COMMAND_ID , WORKSPACE_RECOMMENDATIONS_VIEW_ID , IWorkspaceRecommendedExtensionsView , AutoUpdateConfigurationKey , HasOutdatedExtensionsContext , SELECT_INSTALL_VSIX_EXTENSION_COMMAND_ID , LIST_WORKSPACE_UNSUPPORTED_EXTENSIONS_COMMAND_ID , ExtensionEditorTab , THEME_ACTIONS_GROUP , INSTALL_ACTIONS_GROUP , OUTDATED_EXTENSIONS_VIEW_ID , CONTEXT_HAS_GALLERY , extensionsSearchActionsMenu , UPDATE_ACTIONS_GROUP , IExtensionArg , ExtensionRuntimeActionType , EXTENSIONS_CATEGORY , AutoRestartConfigurationKey , extensionsFilterSubMenu , DefaultViewsContext , CONTEXT_EXTENSIONS_GALLERY_STATUS } from '../common/extensions.js' ;
18
18
import { InstallSpecificVersionOfExtensionAction , ConfigureWorkspaceRecommendedExtensionsAction , ConfigureWorkspaceFolderRecommendedExtensionsAction , SetColorThemeAction , SetFileIconThemeAction , SetProductIconThemeAction , ClearLanguageAction , ToggleAutoUpdateForExtensionAction , ToggleAutoUpdatesForPublisherAction , TogglePreReleaseExtensionAction , InstallAnotherVersionAction , InstallAction } from './extensionsActions.js' ;
19
19
import { ExtensionsInput } from '../common/extensionsInput.js' ;
20
20
import { ExtensionEditor } from './extensionEditor.js' ;
21
- import { StatusUpdater , MaliciousExtensionChecker , ExtensionsViewletViewsContribution , ExtensionsViewPaneContainer , BuiltInExtensionsContext , SearchMarketplaceExtensionsContext , RecommendedExtensionsContext , ExtensionsSortByContext , SearchHasTextContext , ExtensionsSearchValueContext } from './extensionsViewlet.js' ;
21
+ import { StatusUpdater , MaliciousExtensionChecker , ExtensionsViewletViewsContribution , ExtensionsViewPaneContainer , BuiltInExtensionsContext , SearchMarketplaceExtensionsContext , RecommendedExtensionsContext , ExtensionsSortByContext , SearchHasTextContext , ExtensionsSearchValueContext , ExtensionMarketplaceStatusUpdater } from './extensionsViewlet.js' ;
22
22
import { IConfigurationRegistry , Extensions as ConfigurationExtensions , ConfigurationScope } from '../../../../platform/configuration/common/configurationRegistry.js' ;
23
23
import * as jsonContributionRegistry from '../../../../platform/jsonschemas/common/jsonContributionRegistry.js' ;
24
24
import { ExtensionsConfigurationSchema , ExtensionsConfigurationSchemaId } from '../common/extensionsFileTemplate.js' ;
@@ -81,9 +81,10 @@ import { IConfigurationMigrationRegistry, Extensions as ConfigurationMigrationEx
81
81
import { IProductService } from '../../../../platform/product/common/productService.js' ;
82
82
import { IUserDataProfilesService } from '../../../../platform/userDataProfile/common/userDataProfile.js' ;
83
83
import product from '../../../../platform/product/common/product.js' ;
84
- import { ExtensionGalleryResourceType , ExtensionGalleryServiceUrlConfigKey , getExtensionGalleryManifestResourceUri , IExtensionGalleryManifest , IExtensionGalleryManifestService } from '../../../../platform/extensionManagement/common/extensionGalleryManifest.js' ;
84
+ import { ExtensionGalleryResourceType , ExtensionGalleryServiceUrlConfigKey , getExtensionGalleryManifestResourceUri , IExtensionGalleryManifestService , ExtensionGalleryManifestStatus , IExtensionGalleryManifest } from '../../../../platform/extensionManagement/common/extensionGalleryManifest.js' ;
85
85
import { ILanguageModelToolsService } from '../../chat/common/languageModelToolsService.js' ;
86
86
import { SearchExtensionsTool , SearchExtensionsToolData } from '../common/searchExtensionsTool.js' ;
87
+ import { DEFAULT_ACCOUNT_SIGN_IN_COMMAND } from '../../../services/accounts/common/defaultAccount.js' ;
87
88
88
89
// Singletons
89
90
registerSingleton ( IExtensionsWorkbenchService , ExtensionsWorkbenchService , InstantiationType . Eager /* Auto updates extensions */ ) ;
@@ -523,8 +524,7 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
523
524
constructor (
524
525
@IExtensionManagementService private readonly extensionManagementService : IExtensionManagementService ,
525
526
@IExtensionManagementServerService private readonly extensionManagementServerService : IExtensionManagementServerService ,
526
- @IExtensionGalleryService extensionGalleryService : IExtensionGalleryService ,
527
- @IExtensionGalleryManifestService extensionGalleryManifestService : IExtensionGalleryManifestService ,
527
+ @IExtensionGalleryManifestService private readonly extensionGalleryManifestService : IExtensionGalleryManifestService ,
528
528
@IContextKeyService private readonly contextKeyService : IContextKeyService ,
529
529
@IViewsService private readonly viewsService : IViewsService ,
530
530
@IExtensionsWorkbenchService private readonly extensionsWorkbenchService : IExtensionsWorkbenchService ,
@@ -535,11 +535,6 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
535
535
@IProductService private readonly productService : IProductService ,
536
536
) {
537
537
super ( ) ;
538
- const hasGalleryContext = CONTEXT_HAS_GALLERY . bindTo ( contextKeyService ) ;
539
- if ( extensionGalleryService . isEnabled ( ) ) {
540
- hasGalleryContext . set ( true ) ;
541
- }
542
-
543
538
const hasLocalServerContext = CONTEXT_HAS_LOCAL_SERVER . bindTo ( contextKeyService ) ;
544
539
if ( this . extensionManagementServerService . localExtensionManagementServer ) {
545
540
hasLocalServerContext . set ( true ) ;
@@ -555,17 +550,24 @@ class ExtensionsContributions extends Disposable implements IWorkbenchContributi
555
550
hasWebServerContext . set ( true ) ;
556
551
}
557
552
553
+ this . updateExtensionGalleryStatusContexts ( ) ;
554
+ this . _register ( extensionGalleryManifestService . onDidChangeExtensionGalleryManifestStatus ( ( ) => this . updateExtensionGalleryStatusContexts ( ) ) ) ;
558
555
extensionGalleryManifestService . getExtensionGalleryManifest ( )
559
556
. then ( extensionGalleryManifest => {
560
- this . registerGalleryCapabilitiesContexts ( extensionGalleryManifest ) ;
561
- this . _register ( extensionGalleryManifestService . onDidChangeExtensionGalleryManifest ( extensionGalleryManifest => this . registerGalleryCapabilitiesContexts ( extensionGalleryManifest ) ) ) ;
557
+ this . updateGalleryCapabilitiesContexts ( extensionGalleryManifest ) ;
558
+ this . _register ( extensionGalleryManifestService . onDidChangeExtensionGalleryManifest ( extensionGalleryManifest => this . updateGalleryCapabilitiesContexts ( extensionGalleryManifest ) ) ) ;
562
559
} ) ;
563
560
this . registerGlobalActions ( ) ;
564
561
this . registerContextMenuActions ( ) ;
565
562
this . registerQuickAccessProvider ( ) ;
566
563
}
567
564
568
- private async registerGalleryCapabilitiesContexts ( extensionGalleryManifest : IExtensionGalleryManifest | null ) : Promise < void > {
565
+ private async updateExtensionGalleryStatusContexts ( ) : Promise < void > {
566
+ CONTEXT_HAS_GALLERY . bindTo ( this . contextKeyService ) . set ( this . extensionGalleryManifestService . extensionGalleryManifestStatus === ExtensionGalleryManifestStatus . Available ) ;
567
+ CONTEXT_EXTENSIONS_GALLERY_STATUS . bindTo ( this . contextKeyService ) . set ( this . extensionGalleryManifestService . extensionGalleryManifestStatus ) ;
568
+ }
569
+
570
+ private async updateGalleryCapabilitiesContexts ( extensionGalleryManifest : IExtensionGalleryManifest | null ) : Promise < void > {
569
571
CONTEXT_GALLERY_SORT_CAPABILITIES . bindTo ( this . contextKeyService ) . set ( `_${ extensionGalleryManifest ?. capabilities . extensionQuery . sorting ?. map ( s => s . name ) ?. join ( '_' ) } _UpdateDate_` ) ;
570
572
CONTEXT_GALLERY_FILTER_CAPABILITIES . bindTo ( this . contextKeyService ) . set ( `_${ extensionGalleryManifest ?. capabilities . extensionQuery . filtering ?. map ( s => s . name ) ?. join ( '_' ) } _` ) ;
571
573
CONTEXT_GALLERY_ALL_PUBLIC_REPOSITORY_SIGNED . bindTo ( this . contextKeyService ) . set ( ! ! extensionGalleryManifest ?. capabilities ?. signing ?. allPublicRepositorySigned ) ;
@@ -2023,6 +2025,7 @@ workbenchRegistry.registerWorkbenchContribution(ExtensionEnablementWorkspaceTrus
2023
2025
workbenchRegistry . registerWorkbenchContribution ( ExtensionsCompletionItemsProvider , LifecyclePhase . Restored ) ;
2024
2026
workbenchRegistry . registerWorkbenchContribution ( UnsupportedExtensionsMigrationContrib , LifecyclePhase . Eventually ) ;
2025
2027
workbenchRegistry . registerWorkbenchContribution ( TrustedPublishersInitializer , LifecyclePhase . Eventually ) ;
2028
+ workbenchRegistry . registerWorkbenchContribution ( ExtensionMarketplaceStatusUpdater , LifecyclePhase . Eventually ) ;
2026
2029
if ( isWeb ) {
2027
2030
workbenchRegistry . registerWorkbenchContribution ( ExtensionStorageCleaner , LifecyclePhase . Eventually ) ;
2028
2031
}
@@ -2033,6 +2036,22 @@ registerWorkbenchContribution2(ExtensionToolsContribution.ID, ExtensionToolsCont
2033
2036
// Running Extensions
2034
2037
registerAction2 ( ShowRuntimeExtensionsAction ) ;
2035
2038
2039
+ registerAction2 ( class ExtensionsGallerySignInAction extends Action2 {
2040
+ constructor ( ) {
2041
+ super ( {
2042
+ id : 'workbench.extensions.actions.gallery.signIn' ,
2043
+ title : localize2 ( 'signInToMarketplace' , 'Sign in to access Extensions Marketplace' ) ,
2044
+ menu : {
2045
+ id : MenuId . AccountsContext ,
2046
+ when : CONTEXT_EXTENSIONS_GALLERY_STATUS . isEqualTo ( ExtensionGalleryManifestStatus . RequiresSignIn )
2047
+ } ,
2048
+ } ) ;
2049
+ }
2050
+ run ( accessor : ServicesAccessor ) : Promise < void > {
2051
+ return accessor . get ( ICommandService ) . executeCommand ( DEFAULT_ACCOUNT_SIGN_IN_COMMAND ) ;
2052
+ }
2053
+ } ) ;
2054
+
2036
2055
Registry . as < IConfigurationMigrationRegistry > ( ConfigurationMigrationExtensions . ConfigurationMigration )
2037
2056
. registerConfigurationMigrations ( [ {
2038
2057
key : AutoUpdateConfigurationKey ,
0 commit comments