Skip to content

Commit be210b3

Browse files
authored
Put implicit context checkbox behind a setting (#207788)
1 parent 123360f commit be210b3

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

src/vs/workbench/contrib/chat/browser/chat.contribution.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ configurationRegistry.registerConfiguration({
9292
type: 'number',
9393
description: nls.localize('interactiveSession.editor.lineHeight', "Controls the line height in pixels in chat codeblocks. Use 0 to compute the line height from the font size."),
9494
default: 0
95-
}
95+
},
96+
'chat.experimental.implicitContext': {
97+
type: 'boolean',
98+
description: nls.localize('chat.experimental.implicitContext', "Controls whether a checkbox is shown to allow the user to determine which implicit context is included with a chat participant's prompt."),
99+
default: false
100+
},
96101
}
97102
});
98103

src/vs/workbench/contrib/chat/browser/chatContributionServiceImpl.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ const chatParticipantExtensionPoint = extensionsRegistry.ExtensionsRegistry.regi
8484
markdownDescription: localize('chatParticipantIsDefaultDescription', "**Only** allowed for extensions that have the `defaultChatParticipant` proposal."),
8585
type: 'boolean',
8686
},
87-
defaultImplicitTools: {
88-
markdownDescription: 'The names of the tools that are invoked by default',
87+
defaultImplicitVariables: {
88+
markdownDescription: 'The names of the variables that are invoked by default',
8989
type: 'array',
9090
items: {
9191
type: 'string'

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
8080
private implicitContextContainer!: HTMLElement;
8181
private implicitContextLabel!: HTMLElement;
8282
private implicitContextCheckbox!: Checkbox;
83+
private implicitContextSettingEnabled = false;
8384
get implicitContextEnabled() {
8485
return this.implicitContextCheckbox.checked;
8586
}
@@ -131,10 +132,16 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
131132

132133
this.history = new HistoryNavigator([], 5);
133134
this._register(this.historyService.onDidClearHistory(() => this.history.clear()));
135+
136+
this.implicitContextSettingEnabled = this.configurationService.getValue<boolean>('chat.experimental.implicitContext');
134137
this._register(this.configurationService.onDidChangeConfiguration(e => {
135138
if (e.affectsConfiguration(AccessibilityVerbositySettingId.Chat)) {
136139
this.inputEditor.updateOptions({ ariaLabel: this._getAriaLabel() });
137140
}
141+
142+
if (e.affectsConfiguration('chat.experimental.implicitContext')) {
143+
this.implicitContextSettingEnabled = this.configurationService.getValue<boolean>('chat.experimental.implicitContext');
144+
}
138145
}));
139146
}
140147

@@ -376,7 +383,7 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
376383
}
377384

378385
setImplicitContextKinds(kinds: string[]) {
379-
dom.setVisibility(kinds.length > 0, this.implicitContextContainer);
386+
dom.setVisibility(this.implicitContextSettingEnabled && kinds.length > 0, this.implicitContextContainer);
380387
this.implicitContextLabel.textContent = localize('use', "Use") + ' ' + kinds.map(k => `#${k}`).join(', ');
381388
}
382389

src/vs/workbench/contrib/chat/browser/chatWidget.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,11 @@ export class ChatWidget extends Disposable implements IChatWidget {
522522
}));
523523
this._register(this.inputPart.onDidChangeHeight(() => this.bodyDimension && this.layout(this.bodyDimension.height, this.bodyDimension.width)));
524524
this._register(this.inputEditor.onDidChangeModelContent(() => this.updateImplicitContextKinds()));
525-
this._register(this.chatAgentService.onDidChangeAgents(() => this.updateImplicitContextKinds()));
525+
this._register(this.chatAgentService.onDidChangeAgents(() => {
526+
if (this.viewModel) {
527+
this.updateImplicitContextKinds();
528+
}
529+
}));
526530
}
527531

528532
private onDidStyleChange(): void {

0 commit comments

Comments
 (0)