Skip to content

Commit decaa08

Browse files
authored
Use correct context keys for share provider title context action (microsoft#236718)
use correct context keys for share provider titile context action
1 parent b8b4db3 commit decaa08

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/vs/workbench/browser/parts/titlebar/titlebarActions.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,9 @@ registerAction2(class ToggleNavigationControl extends ToggleTitleBarConfigAction
6464
}
6565
});
6666

67-
registerAction2(class ToggleShareControl extends ToggleTitleBarConfigAction {
68-
constructor() {
69-
super('workbench.experimental.share.enabled', localize('toggle.share', 'Share'), localize('toggle.shareDescription', "Toggle visibility of the Share action in title bar"), 2, false, ContextKeyExpr.has('config.window.commandCenter'));
70-
}
71-
});
72-
7367
registerAction2(class ToggleLayoutControl extends ToggleTitleBarConfigAction {
7468
constructor() {
75-
super(LayoutSettings.LAYOUT_ACTIONS, localize('toggle.layout', 'Layout Controls'), localize('toggle.layoutDescription', "Toggle visibility of the Layout Controls in title bar"), 3, true);
69+
super(LayoutSettings.LAYOUT_ACTIONS, localize('toggle.layout', 'Layout Controls'), localize('toggle.layoutDescription', "Toggle visibility of the Layout Controls in title bar"), 4, true);
7670
}
7771
});
7872

src/vs/workbench/contrib/chat/browser/actions/chatActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ registerAction2(class ToggleCopilotControl extends ToggleTitleBarConfigAction {
543543
super(
544544
'chat.commandCenter.enabled',
545545
localize('toggle.chatControl', 'Copilot Controls'),
546-
localize('toggle.chatControlsDescription', "Toggle visibility of the Copilot Controls in title bar"), 4, false,
546+
localize('toggle.chatControlsDescription', "Toggle visibility of the Copilot Controls in title bar"), 5, false,
547547
ContextKeyExpr.and(
548548
ChatContextKeys.supported,
549549
ContextKeyExpr.has('config.window.commandCenter')

src/vs/workbench/contrib/share/browser/shareService.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ import { URI } from '../../../../base/common/uri.js';
99
import { ICodeEditorService } from '../../../../editor/browser/services/codeEditorService.js';
1010
import { score } from '../../../../editor/common/languageSelector.js';
1111
import { localize } from '../../../../nls.js';
12-
import { ISubmenuItem } from '../../../../platform/actions/common/actions.js';
13-
import { IContextKey, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
12+
import { ISubmenuItem, registerAction2 } from '../../../../platform/actions/common/actions.js';
13+
import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';
1414
import { ILabelService } from '../../../../platform/label/common/label.js';
1515
import { IQuickInputService, IQuickPickItem } from '../../../../platform/quickinput/common/quickInput.js';
1616
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
17+
import { ToggleTitleBarConfigAction } from '../../../browser/parts/titlebar/titlebarActions.js';
18+
import { WorkspaceFolderCountContext } from '../../../common/contextkeys.js';
1719
import { IShareProvider, IShareService, IShareableItem } from '../common/share.js';
1820

1921
export const ShareProviderCountContext = new RawContextKey<number>('shareProviderCount', 0, localize('shareProviderCount', "The number of available share providers"));
@@ -84,3 +86,9 @@ export class ShareService implements IShareService {
8486
return;
8587
}
8688
}
89+
90+
registerAction2(class ToggleShareControl extends ToggleTitleBarConfigAction {
91+
constructor() {
92+
super('workbench.experimental.share.enabled', localize('toggle.share', 'Share'), localize('toggle.shareDescription', "Toggle visibility of the Share action in title bar"), 3, false, ContextKeyExpr.and(ContextKeyExpr.has('config.window.commandCenter'), ContextKeyExpr.and(ShareProviderCountContext.notEqualsTo(0), WorkspaceFolderCountContext.notEqualsTo(0))));
93+
}
94+
});

0 commit comments

Comments
 (0)