mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Fix adding @ to /help followup (#208497)
This commit is contained in:
parent
50b43a6811
commit
f23beb2475
|
@ -38,6 +38,7 @@ import { ChatModelInitState, IChatModel } from 'vs/workbench/contrib/chat/common
|
|||
import { IParsedChatRequest, chatAgentLeader, chatSubcommandLeader, extractAgentAndCommand } from 'vs/workbench/contrib/chat/common/chatParserTypes';
|
||||
import { ChatRequestParser } from 'vs/workbench/contrib/chat/common/chatRequestParser';
|
||||
import { IChatFollowup, IChatService } from 'vs/workbench/contrib/chat/common/chatService';
|
||||
import { IChatSlashCommandService } from 'vs/workbench/contrib/chat/common/chatSlashCommands';
|
||||
import { ChatViewModel, IChatResponseViewModel, isRequestVM, isResponseVM, isWelcomeVM } from 'vs/workbench/contrib/chat/common/chatViewModel';
|
||||
import { CodeBlockModelCollection } from 'vs/workbench/contrib/chat/common/codeBlockModelCollection';
|
||||
import { IViewsService } from 'vs/workbench/services/views/common/viewsService';
|
||||
|
@ -163,10 +164,10 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
@IChatAgentService private readonly chatAgentService: IChatAgentService,
|
||||
@IChatWidgetService chatWidgetService: IChatWidgetService,
|
||||
@IContextMenuService private readonly contextMenuService: IContextMenuService,
|
||||
@IChatAccessibilityService private readonly _chatAccessibilityService: IChatAccessibilityService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
@ILogService private readonly _logService: ILogService,
|
||||
@IThemeService private readonly _themeService: IThemeService,
|
||||
@IChatAccessibilityService private readonly chatAccessibilityService: IChatAccessibilityService,
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IThemeService private readonly themeService: IThemeService,
|
||||
@IChatSlashCommandService private readonly chatSlashCommandService: IChatSlashCommandService,
|
||||
) {
|
||||
super();
|
||||
CONTEXT_IN_CHAT_SESSION.bindTo(contextKeyService).set(true);
|
||||
|
@ -276,7 +277,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
try {
|
||||
return this._register(this.instantiationService.createInstance(contrib, this));
|
||||
} catch (err) {
|
||||
this._logService.error('Failed to instantiate chat widget contrib', toErrorMessage(err));
|
||||
this.logService.error('Failed to instantiate chat widget contrib', toErrorMessage(err));
|
||||
return undefined;
|
||||
}
|
||||
}).filter(isDefined);
|
||||
|
@ -426,7 +427,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
horizontalScrolling: false,
|
||||
supportDynamicHeights: true,
|
||||
hideTwistiesOfChildlessElements: true,
|
||||
accessibilityProvider: this._instantiationService.createInstance(ChatAccessibilityProvider),
|
||||
accessibilityProvider: this.instantiationService.createInstance(ChatAccessibilityProvider),
|
||||
keyboardNavigationLabelProvider: { getKeyboardNavigationLabel: (e: ChatTreeItem) => isRequestVM(e) ? e.message : isResponseVM(e) ? e.response.value : '' }, // TODO
|
||||
setRowLineHeight: false,
|
||||
filter: this.viewOptions.filter ? { filter: this.viewOptions.filter.bind(this.viewOptions), } : undefined,
|
||||
|
@ -521,12 +522,15 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
}
|
||||
|
||||
let msg = '';
|
||||
if (e.followup.agentId !== this.chatAgentService.getDefaultAgent(this.location)?.id) {
|
||||
if (e.followup.agentId && e.followup.agentId !== this.chatAgentService.getDefaultAgent(this.location)?.id) {
|
||||
msg = `${chatAgentLeader}${e.followup.agentId} `;
|
||||
if (e.followup.subCommand) {
|
||||
msg += `${chatSubcommandLeader}${e.followup.subCommand} `;
|
||||
}
|
||||
} else if (!e.followup.agentId && e.followup.subCommand && this.chatSlashCommandService.hasCommand(e.followup.subCommand)) {
|
||||
msg = `${chatSubcommandLeader}${e.followup.subCommand} `;
|
||||
}
|
||||
|
||||
msg += e.followup.message;
|
||||
this.acceptInput(msg);
|
||||
|
||||
|
@ -560,7 +564,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
private onDidStyleChange(): void {
|
||||
this.container.style.setProperty('--vscode-interactive-result-editor-background-color', this.editorOptions.configuration.resultEditor.backgroundColor?.toString() ?? '');
|
||||
this.container.style.setProperty('--vscode-interactive-session-foreground', this.editorOptions.configuration.foreground?.toString() ?? '');
|
||||
this.container.style.setProperty('--vscode-chat-list-background', this._themeService.getColorTheme().getColor(this.styles.listBackground)?.toString() ?? '');
|
||||
this.container.style.setProperty('--vscode-chat-list-background', this.themeService.getColorTheme().getColor(this.styles.listBackground)?.toString() ?? '');
|
||||
}
|
||||
|
||||
private updateImplicitContextKinds() {
|
||||
|
@ -687,7 +691,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
this._onDidAcceptInput.fire();
|
||||
|
||||
const editorValue = this.getInput();
|
||||
const requestId = this._chatAccessibilityService.acceptRequest();
|
||||
const requestId = this.chatAccessibilityService.acceptRequest();
|
||||
const input = !opts ? editorValue :
|
||||
'query' in opts ? opts.query :
|
||||
`${opts.prefix} ${editorValue}`;
|
||||
|
@ -701,7 +705,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|||
result.responseCompletePromise.then(async () => {
|
||||
const responses = this.viewModel?.getItems().filter(isResponseVM);
|
||||
const lastResponse = responses?.[responses.length - 1];
|
||||
this._chatAccessibilityService.acceptResponse(lastResponse, requestId);
|
||||
this.chatAccessibilityService.acceptResponse(lastResponse, requestId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue