Skip to content

Commit 8b617bd

Browse files
authored
Merge pull request #192346 from microsoft/roblou/obvious-seahorse
Add setting to disable chat history variables
2 parents cec6e5b + 448a760 commit 8b617bd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { CompletionContext, CompletionItem, CompletionItemKind, CompletionList }
1515
import { ITextModel } from 'vs/editor/common/model';
1616
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
1717
import { localize } from 'vs/nls';
18+
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1819
import { Registry } from 'vs/platform/registry/common/platform';
1920
import { inputPlaceholderForeground } from 'vs/platform/theme/common/colorRegistry';
2021
import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -357,6 +358,7 @@ class VariableCompletions extends Disposable {
357358
@ILanguageFeaturesService private readonly languageFeaturesService: ILanguageFeaturesService,
358359
@IChatWidgetService private readonly chatWidgetService: IChatWidgetService,
359360
@IChatVariablesService private readonly chatVariablesService: IChatVariablesService,
361+
@IConfigurationService private readonly configurationService: IConfigurationService,
360362
) {
361363
super();
362364

@@ -389,13 +391,14 @@ class VariableCompletions extends Disposable {
389391
.filter(isResponseVM);
390392

391393
// TODO@roblourens work out a real API for this- maybe it can be part of the two-step flow that @file will probably use
392-
const historyItems = history.map((h, i): CompletionItem => ({
394+
const historyVariablesEnabled = this.configurationService.getValue('chat.experimental.historyVariables');
395+
const historyItems = historyVariablesEnabled ? history.map((h, i): CompletionItem => ({
393396
label: `@response:${i + 1}`,
394397
detail: h.response.asString(),
395398
insertText: `@response:${String(i + 1).padStart(String(history.length).length, '0')} `,
396399
kind: CompletionItemKind.Text,
397400
range: { insert, replace },
398-
}));
401+
})) : [];
399402

400403
const variableItems = Array.from(this.chatVariablesService.getVariables()).map(v => {
401404
const withAt = `@${v.name}`;

0 commit comments

Comments
 (0)