Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,12 @@ export class InlineChatWidget {
if (!viewModel) {
return undefined;
}
for (const item of viewModel.getItems()) {
if (isResponseVM(item)) {
return viewModel.codeBlockModelCollection.get(viewModel.sessionId, item, codeBlockIndex)?.model;
}
const items = viewModel.getItems().filter(i => isResponseVM(i));
Comment thread
meganrogge marked this conversation as resolved.
if (!items.length) {
return;
}
return undefined;
const item = items[items.length - 1];
return viewModel.codeBlockModelCollection.get(viewModel.sessionId, item, codeBlockIndex)?.model;
}

get responseContent(): string | undefined {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export const enum TerminalChatCommandId {
Discard = 'workbench.action.terminal.chat.discard',
MakeRequest = 'workbench.action.terminal.chat.makeRequest',
Cancel = 'workbench.action.terminal.chat.cancel',
FeedbackHelpful = 'workbench.action.terminal.chat.feedbackHelpful',
FeedbackUnhelpful = 'workbench.action.terminal.chat.feedbackUnhelpful',
FeedbackReportIssue = 'workbench.action.terminal.chat.feedbackReportIssue',
RunCommand = 'workbench.action.terminal.chat.runCommand',
RunFirstCommand = 'workbench.action.terminal.chat.runFirstCommand',
InsertCommand = 'workbench.action.terminal.chat.insertCommand',
Expand All @@ -30,7 +27,6 @@ export const enum TerminalChatCommandId {
export const MENU_TERMINAL_CHAT_INPUT = MenuId.for('terminalChatInput');
export const MENU_TERMINAL_CHAT_WIDGET = MenuId.for('terminalChatWidget');
export const MENU_TERMINAL_CHAT_WIDGET_STATUS = MenuId.for('terminalChatWidget.status');
export const MENU_TERMINAL_CHAT_WIDGET_FEEDBACK = MenuId.for('terminalChatWidget.feedback');
export const MENU_TERMINAL_CHAT_WIDGET_TOOLBAR = MenuId.for('terminalChatWidget.toolbar');

export const enum TerminalChatContextKeyStrings {
Expand Down Expand Up @@ -61,18 +57,9 @@ export namespace TerminalChatContextKeys {
/** Whether the chat input has text */
export const inputHasText = new RawContextKey<boolean>(TerminalChatContextKeyStrings.ChatInputHasText, false, localize('chatInputHasTextContextKey', "Whether the chat input has text."));

/** Whether the terminal chat agent has been registered */
export const agentRegistered = new RawContextKey<boolean>(TerminalChatContextKeyStrings.ChatAgentRegistered, false, localize('chatAgentRegisteredContextKey', "Whether the terminal chat agent has been registered."));

/** The chat response contains at least one code block */
export const responseContainsCodeBlock = new RawContextKey<boolean>(TerminalChatContextKeyStrings.ChatResponseContainsCodeBlock, false, localize('chatResponseContainsCodeBlockContextKey', "Whether the chat response contains a code block."));

/** The chat response contains multiple code blocks */
export const responseContainsMultipleCodeBlocks = new RawContextKey<boolean>(TerminalChatContextKeyStrings.ChatResponseContainsMultipleCodeBlocks, false, localize('chatResponseContainsMultipleCodeBlocksContextKey', "Whether the chat response contains multiple code blocks."));

/** Whether the response supports issue reporting */
export const responseSupportsIssueReporting = new RawContextKey<boolean>(TerminalChatContextKeyStrings.ChatResponseSupportsIssueReporting, false, localize('chatResponseSupportsIssueReportingContextKey', "Whether the response supports issue reporting"));

/** The chat vote, if any for the response, if any */
export const sessionResponseVote = new RawContextKey<string>(TerminalChatContextKeyStrings.ChatSessionResponseVote, undefined, { type: 'string', description: localize('interactiveSessionResponseVote', "When the response has been voted up, is set to 'up'. When voted down, is set to 'down'. Otherwise an empty string.") });
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_AGE
import { isDetachedTerminalInstance } from 'vs/workbench/contrib/terminal/browser/terminal';
import { registerActiveXtermAction } from 'vs/workbench/contrib/terminal/browser/terminalActions';
import { TerminalContextKeys } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
import { MENU_TERMINAL_CHAT_INPUT, MENU_TERMINAL_CHAT_WIDGET, MENU_TERMINAL_CHAT_WIDGET_FEEDBACK, MENU_TERMINAL_CHAT_WIDGET_STATUS, TerminalChatCommandId, TerminalChatContextKeys } from 'vs/workbench/contrib/terminalContrib/chat/browser/terminalChat';
import { MENU_TERMINAL_CHAT_INPUT, MENU_TERMINAL_CHAT_WIDGET, MENU_TERMINAL_CHAT_WIDGET_STATUS, TerminalChatCommandId, TerminalChatContextKeys } from 'vs/workbench/contrib/terminalContrib/chat/browser/terminalChat';
import { TerminalChatController } from 'vs/workbench/contrib/terminalContrib/chat/browser/terminalChatController';

registerActiveXtermAction({
Expand Down Expand Up @@ -164,7 +164,6 @@ registerActiveXtermAction({
precondition: ContextKeyExpr.and(
ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated),
TerminalChatContextKeys.requestActive.negate(),
TerminalChatContextKeys.agentRegistered,
TerminalChatContextKeys.responseContainsCodeBlock,
TerminalChatContextKeys.responseContainsMultipleCodeBlocks.negate()
),
Expand Down Expand Up @@ -196,7 +195,6 @@ registerActiveXtermAction({
precondition: ContextKeyExpr.and(
ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated),
TerminalChatContextKeys.requestActive.negate(),
TerminalChatContextKeys.agentRegistered,
TerminalChatContextKeys.responseContainsMultipleCodeBlocks
),
icon: Codicon.play,
Expand Down Expand Up @@ -227,7 +225,6 @@ registerActiveXtermAction({
precondition: ContextKeyExpr.and(
ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated),
TerminalChatContextKeys.requestActive.negate(),
TerminalChatContextKeys.agentRegistered,
TerminalChatContextKeys.responseContainsCodeBlock,
TerminalChatContextKeys.responseContainsMultipleCodeBlocks.negate()
),
Expand Down Expand Up @@ -259,7 +256,6 @@ registerActiveXtermAction({
precondition: ContextKeyExpr.and(
ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated),
TerminalChatContextKeys.requestActive.negate(),
TerminalChatContextKeys.agentRegistered,
TerminalChatContextKeys.responseContainsMultipleCodeBlocks
),
keybinding: {
Expand Down Expand Up @@ -289,7 +285,6 @@ registerActiveXtermAction({
precondition: ContextKeyExpr.and(
ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated),
TerminalChatContextKeys.requestActive.negate(),
TerminalChatContextKeys.agentRegistered,
),
icon: Codicon.commentDiscussion,
menu: [{
Expand Down Expand Up @@ -319,7 +314,6 @@ registerActiveXtermAction({
precondition: ContextKeyExpr.and(
ContextKeyExpr.or(TerminalContextKeys.processSupported, TerminalContextKeys.terminalHasBeenCreated),
TerminalChatContextKeys.requestActive.negate(),
TerminalChatContextKeys.agentRegistered,
CTX_INLINE_CHAT_EMPTY.negate()
),
icon: Codicon.send,
Expand Down Expand Up @@ -348,7 +342,6 @@ registerActiveXtermAction({
title: localize2('cancelChat', 'Cancel Chat'),
precondition: ContextKeyExpr.and(
TerminalChatContextKeys.requestActive,
TerminalChatContextKeys.agentRegistered
),
icon: Codicon.debugStop,
menu: {
Expand All @@ -366,25 +359,39 @@ registerActiveXtermAction({
});

registerActiveXtermAction({
id: TerminalChatCommandId.FeedbackReportIssue,
title: localize2('reportIssue', 'Report Issue'),
precondition: ContextKeyExpr.and(
TerminalChatContextKeys.requestActive.negate(),
TerminalChatContextKeys.responseContainsCodeBlock.notEqualsTo(undefined),
TerminalChatContextKeys.responseSupportsIssueReporting
),
icon: Codicon.report,
menu: [{
id: MENU_TERMINAL_CHAT_WIDGET_FEEDBACK,
when: ContextKeyExpr.and(TerminalChatContextKeys.responseContainsCodeBlock.notEqualsTo(undefined), TerminalChatContextKeys.responseSupportsIssueReporting),
group: 'inline',
order: 3
}],
id: TerminalChatCommandId.PreviousFromHistory,
title: localize2('previousFromHitory', 'Previous From History'),
precondition: TerminalChatContextKeys.focused,
keybinding: {
when: TerminalChatContextKeys.focused,
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.UpArrow,
},

run: (_xterm, _accessor, activeInstance) => {
if (isDetachedTerminalInstance(activeInstance)) {
return;
}
const contr = TerminalChatController.activeChatWidget || TerminalChatController.get(activeInstance);
contr?.populateHistory(true);
}
});

registerActiveXtermAction({
id: TerminalChatCommandId.NextFromHistory,
title: localize2('nextFromHitory', 'Next From History'),
precondition: TerminalChatContextKeys.focused,
keybinding: {
when: TerminalChatContextKeys.focused,
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyCode.DownArrow,
},

run: (_xterm, _accessor, activeInstance) => {
if (isDetachedTerminalInstance(activeInstance)) {
return;
}
const contr = TerminalChatController.activeChatWidget || TerminalChatController.get(activeInstance);
contr?.acceptFeedback();
contr?.populateHistory(false);
}
});
Loading