Skip to content

Commit 856b69c

Browse files
authored
Merge pull request microsoft#199538 from microsoft/aiday/simplifyingContextKey
Simplifying context key for the setting inlineChat.showToolbarIcon
2 parents 3d990fc + a42d653 commit 856b69c

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

src/vs/workbench/contrib/inlineChat/browser/inlineChatDecorations.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/co
1616
import { DisposableStore, Disposable } from 'vs/base/common/lifecycle';
1717
import { GutterActionsRegistry } from 'vs/workbench/contrib/codeEditor/browser/editorLineNumberMenu';
1818
import { Action } from 'vs/base/common/actions';
19-
import { CTX_INLINE_CHAT_TOOLBAR_ICON_ENABLED, IInlineChatService, ShowGutterIcon } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
19+
import { IInlineChatService, ShowGutterIcon } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
2020
import { RunOnceScheduler } from 'vs/base/common/async';
2121
import { Iterable } from 'vs/base/common/iterator';
2222
import { Range } from 'vs/editor/common/core/range';
@@ -27,14 +27,13 @@ import { LOCALIZED_START_INLINE_CHAT_STRING } from 'vs/workbench/contrib/inlineC
2727
import { IBreakpoint, IDebugService, IDebugSession } from 'vs/workbench/contrib/debug/common/debug';
2828
import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences';
2929
import { URI } from 'vs/base/common/uri';
30-
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
30+
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
3131

3232
const GUTTER_INLINE_CHAT_OPAQUE_ICON = registerIcon('inline-chat-opaque', Codicon.sparkle, localize('startInlineChatOpaqueIcon', 'Icon which spawns the inline chat from the gutter. It is half opaque by default and becomes completely opaque on hover.'));
3333
const GUTTER_INLINE_CHAT_TRANSPARENT_ICON = registerIcon('inline-chat-transparent', Codicon.sparkle, localize('startInlineChatTransparentIcon', 'Icon which spawns the inline chat from the gutter. It is transparent by default and becomes opaque on hover.'));
3434

3535
export class InlineChatDecorationsContribution extends Disposable implements IEditorContribution {
3636

37-
private _ctxToolbarIconEnabled: IContextKey<boolean>;
3837
private _currentBreakpoints: readonly IBreakpoint[] = [];
3938
private _gutterDecorationID: string | undefined;
4039
private _inlineChatKeybinding: string | undefined;
@@ -62,13 +61,7 @@ export class InlineChatDecorationsContribution extends Disposable implements IEd
6261
super();
6362
this._gutterDecorationTransparent = this._registerGutterDecoration(true);
6463
this._gutterDecorationOpaque = this._registerGutterDecoration(false);
65-
this._ctxToolbarIconEnabled = CTX_INLINE_CHAT_TOOLBAR_ICON_ENABLED.bindTo(_contextKeyService);
66-
this._setToolbarIconEnablementToSetting();
6764
this._register(this._configurationService.onDidChangeConfiguration((e: IConfigurationChangeEvent) => {
68-
if (e.affectsConfiguration(InlineChatDecorationsContribution.TOOLBAR_SETTING_ID)) {
69-
this._setToolbarIconEnablementToSetting();
70-
return;
71-
}
7265
if (!e.affectsConfiguration(InlineChatDecorationsContribution.GUTTER_SETTING_ID)) {
7366
return;
7467
}
@@ -110,10 +103,6 @@ export class InlineChatDecorationsContribution extends Disposable implements IEd
110103
this._onEnablementOrModelChanged();
111104
}
112105

113-
private _setToolbarIconEnablementToSetting(): void {
114-
this._ctxToolbarIconEnabled.set(this._configurationService.getValue<boolean>(InlineChatDecorationsContribution.TOOLBAR_SETTING_ID));
115-
}
116-
117106
private _registerGutterDecoration(isTransparent: boolean): ModelDecorationOptions {
118107
return ModelDecorationOptions.register({
119108
description: 'inline-chat-decoration',

src/vs/workbench/contrib/inlineChat/common/inlineChat.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export const CTX_INLINE_CHAT_DOCUMENT_CHANGED = new RawContextKey<boolean>('inli
155155
export const CTX_INLINE_CHAT_CHANGE_HAS_DIFF = new RawContextKey<boolean>('inlineChatChangeHasDiff', false, localize('inlineChatChangeHasDiff', "Whether the current change supports showing a diff"));
156156
export const CTX_INLINE_CHAT_CHANGE_SHOWS_DIFF = new RawContextKey<boolean>('inlineChatChangeShowsDiff', false, localize('inlineChatChangeShowsDiff', "Whether the current change showing a diff"));
157157
export const CTX_INLINE_CHAT_EDIT_MODE = new RawContextKey<EditMode>('config.inlineChat.mode', EditMode.Live);
158-
export const CTX_INLINE_CHAT_TOOLBAR_ICON_ENABLED = new RawContextKey<boolean>('inlineChatToolbarIconEnabled', false, localize('inlineChatToolbarIconEnabled', "Whether the toolbar icon spawning inline chat is enabled."));
158+
export const CTX_INLINE_CHAT_TOOLBAR_ICON_ENABLED = new RawContextKey<boolean>('config.inlineChat.showToolbarIcon', false);
159159

160160
// --- (select) action identifier
161161

0 commit comments

Comments
 (0)