Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental terminal inline chat #204844

Merged
merged 147 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
dad5b33
add basics
meganrogge Feb 9, 2024
4f219d7
fix some issues
meganrogge Feb 9, 2024
ab4a695
add hold for speech
meganrogge Feb 9, 2024
dc4ebd8
fix some issues
meganrogge Feb 9, 2024
eedd668
Add setting to disable term inline chat by default
Tyriar Feb 9, 2024
0d202ef
widget per terminal
meganrogge Feb 9, 2024
10e7518
WIP inline chat widget integration
Tyriar Feb 9, 2024
61c82c8
Merge remote-tracking branch 'refs/remotes/origin/merogge/chatWidget3…
Tyriar Feb 9, 2024
73e7e46
More styled inline chat
Tyriar Feb 9, 2024
22670a1
Add temp placeholders
Tyriar Feb 9, 2024
792fc7a
fix focus issues
meganrogge Feb 9, 2024
dfed5c7
Remove detached terminal support
Tyriar Feb 9, 2024
cfeb85d
Anchor term chat to bottom
Tyriar Feb 9, 2024
0a8994c
use terminal menu ID
meganrogge Feb 9, 2024
9e07b3a
Remove detached terminal support
Tyriar Feb 9, 2024
5e3bd93
Fix panel background overriding input's
Tyriar Feb 9, 2024
2611151
Add wip make request button
Tyriar Feb 9, 2024
a8cda87
Fix command name
Tyriar Feb 9, 2024
ceaa923
Merge branch 'main' into merogge/chatWidget3
meganrogge Feb 12, 2024
b79d48c
wip make request action
meganrogge Feb 12, 2024
a0d97ae
contrib => controller
meganrogge Feb 12, 2024
fd07844
wip make request action
meganrogge Feb 12, 2024
b9bdf24
Merge branch 'main' into merogge/chatWidget3
meganrogge Feb 13, 2024
760ee5b
wip
meganrogge Feb 13, 2024
b998b64
Add menus for terminal chat to the terminalContrib
Tyriar Feb 13, 2024
e4e9562
Clean up chat widget
Tyriar Feb 13, 2024
32b3e7e
Standardize chat command ns, add feedback placeholders
Tyriar Feb 13, 2024
611fd5c
Move chat command IDs into contrib
Tyriar Feb 13, 2024
430db3a
Move term chat actions into own file
Tyriar Feb 13, 2024
ab50eb7
Fix compile error, add todo for layer breaker
Tyriar Feb 13, 2024
283b211
alert single code block
meganrogge Feb 13, 2024
582b0be
add response editor
meganrogge Feb 13, 2024
c4519ce
wip render message when no code block comes through
meganrogge Feb 13, 2024
c9c98f0
get chat cancellation action to show up
meganrogge Feb 13, 2024
cf634df
only show if active
meganrogge Feb 13, 2024
7d80e6d
clean up
meganrogge Feb 13, 2024
44d4700
remove things
meganrogge Feb 13, 2024
c4af34e
more clean up
meganrogge Feb 13, 2024
a9cfba2
catch error
meganrogge Feb 13, 2024
1617ebe
ensure terminal agent is registered
meganrogge Feb 13, 2024
d5527a8
add view in chat action even though it doesn't work atm
meganrogge Feb 13, 2024
9af101d
revert View in Chat action since it doesn't work
meganrogge Feb 13, 2024
7ad358b
add accept command action
meganrogge Feb 13, 2024
9992d7d
Fix terminal voice menu ids
Tyriar Feb 13, 2024
7025359
add accept command keybinding
meganrogge Feb 13, 2024
b93cd29
Working terminal voice chat
Tyriar Feb 13, 2024
3960db9
Add voice placeholder
Tyriar Feb 13, 2024
bf1bb65
clear on hide
meganrogge Feb 13, 2024
83f8ee2
rm unused
meganrogge Feb 13, 2024
1fa2679
Merge branch 'main' into merogge/chatWidget3
meganrogge Feb 13, 2024
1d262b3
update variables after rob's change
meganrogge Feb 13, 2024
cd26175
Simplify response editor presentation
Tyriar Feb 13, 2024
84fb082
extract code content, language
meganrogge Feb 13, 2024
fa111ad
add language support
meganrogge Feb 13, 2024
16f1f4b
Add shell language id fallback
Tyriar Feb 13, 2024
8112339
Improve progress feedback
Tyriar Feb 13, 2024
3c306e9
Fix feedback icons
Tyriar Feb 13, 2024
3119ae8
Move accept to status menu
Tyriar Feb 13, 2024
802e746
Simplify localize id
Tyriar Feb 13, 2024
6a6160a
Merge branch 'main' into merogge/chatWidget3
meganrogge Feb 14, 2024
ee47ee2
get accept action to show up, add view in chat action
meganrogge Feb 14, 2024
bfc4df0
add show/hide commands for editor
meganrogge Feb 14, 2024
2b7e5e5
rename and reorder things in terminalChatWidget
meganrogge Feb 14, 2024
1565341
reset everything on hide of widget
meganrogge Feb 14, 2024
55aca1a
more clean up
meganrogge Feb 14, 2024
57857d6
rm unused
meganrogge Feb 14, 2024
a9b4e6f
add accessible view
meganrogge Feb 14, 2024
d881ddb
Add accessibility help dialog
meganrogge Feb 14, 2024
b01c303
add session support, get cancellation to work
meganrogge Feb 15, 2024
216b941
Move to registerWorkbenchContribution2
Tyriar Feb 15, 2024
58f5274
Remove scoped services, they were causing an error and breaking langu…
Tyriar Feb 15, 2024
804a481
Improve command suggestion presentation
Tyriar Feb 15, 2024
bf87f8d
Revert "add session support, get cancellation to work"
meganrogge Feb 15, 2024
55b7c86
use chat model
meganrogge Feb 15, 2024
79ef477
rm unused
meganrogge Feb 15, 2024
f7915fc
Accept -> Run, add insert button, improve keybindings
Tyriar Feb 15, 2024
a9c300c
Trim suggestion to prevent running on alt+enter
Tyriar Feb 15, 2024
4d81b4e
cancel request on clear
meganrogge Feb 15, 2024
50a0433
rename
meganrogge Feb 15, 2024
1a01993
More tweaks to response style
Tyriar Feb 15, 2024
64e1a39
Remove category prefix from commands
Tyriar Feb 15, 2024
85aaa47
Hide command border before it's shown
Tyriar Feb 15, 2024
45e54c6
Wider widget, resize suggestion based on content height
Tyriar Feb 15, 2024
0dadd8f
Trim command before accepting
Tyriar Feb 15, 2024
69592b6
Standardize on workbench contrib weight
Tyriar Feb 15, 2024
06afd59
Await model (fixes lang mode)
Tyriar Feb 15, 2024
b269a4b
Improve handling of wrapping in response editor
Tyriar Feb 15, 2024
aa5626d
fix issue with cancel
meganrogge Feb 15, 2024
a1ac397
Pull response editor into separate class
Tyriar Feb 15, 2024
98e01f9
rm unused
meganrogge Feb 15, 2024
204e5ba
Register chat widget against contr
Tyriar Feb 15, 2024
2453acc
Pull placeholder from model
Tyriar Feb 15, 2024
342570d
Bring back initial placeholder and info on hide
Tyriar Feb 15, 2024
4de80e1
Handle hide/show in editor class
Tyriar Feb 15, 2024
556c0e6
await initialization
meganrogge Feb 15, 2024
7162515
open in chat view
meganrogge Feb 15, 2024
2408cc0
if no model, focus input like quick chat does
meganrogge Feb 15, 2024
a3602c3
Remove margin between chat and response
Tyriar Feb 15, 2024
3c0c510
add chatResponseType context key for terminal
meganrogge Feb 15, 2024
de3d5a4
rm terminal stuff from inline chat actions
meganrogge Feb 15, 2024
a9f226d
fix requestId, sessionId, wip feedback
meganrogge Feb 15, 2024
4b295ed
fix feedback action
meganrogge Feb 15, 2024
ed4a3ce
fix feedback action, add styling
meganrogge Feb 15, 2024
559a341
add support for issue reporting when terminal agent supports that
meganrogge Feb 16, 2024
705d61a
rm todo
meganrogge Feb 16, 2024
881321d
fix aria label for terminal response editor
meganrogge Feb 16, 2024
ee1cb48
add discard action
meganrogge Feb 16, 2024
29924c9
add feedback context key, get styling to apply
meganrogge Feb 16, 2024
ba24d92
move css to right file
meganrogge Feb 16, 2024
189fbdd
Merge remote-tracking branch 'origin/main' into merogge/chatWidget3
Tyriar Feb 16, 2024
c57d306
Move a11y help provider into terminal chat folder
Tyriar Feb 16, 2024
ab75d8d
Remove terminal action ids from inline button config provider
Tyriar Feb 16, 2024
ae04cff
Move context keys and response types into terminalContrib
Tyriar Feb 16, 2024
9b38a27
Remove 'chat' from context keys as it's in the namespace
Tyriar Feb 16, 2024
31df2b2
Revert unneeded change to InlineChatWidget
Tyriar Feb 16, 2024
b9f9060
Clarify lint suppression reason
Tyriar Feb 16, 2024
ec00f84
Remove test string
Tyriar Feb 16, 2024
29d9a36
set vertical position
meganrogge Feb 16, 2024
f70e237
Resolve simple todos, remove duplication
Tyriar Feb 16, 2024
fa68522
rm todo
meganrogge Feb 16, 2024
27d1fc7
Fix position
meganrogge Feb 16, 2024
282fa53
Merge remote-tracking branch 'origin/main' into merogge/chatWidget3
Tyriar Feb 21, 2024
dfe2179
Merge branch 'main' into merogge/chatWidget3
meganrogge Feb 26, 2024
ead787f
fix issue
meganrogge Feb 26, 2024
9b3f22b
only allow starting chat when terminal agent has been registered
meganrogge Feb 26, 2024
51209b3
on hide, reset input value
meganrogge Feb 26, 2024
a1070cb
set vertical position to below cursor line
meganrogge Feb 26, 2024
7d546ba
align start command name with inline chat, get it to show up in comma…
meganrogge Feb 27, 2024
37b2751
fix context keys for terminal chat start/close
meganrogge Feb 27, 2024
d528f1c
render first code block ASAP, fix issue with accessibility service
meganrogge Feb 27, 2024
179eeb6
move all accessibility chat service code into controller
meganrogge Feb 27, 2024
57ebec7
fix width issues
meganrogge Feb 27, 2024
e4a37b2
Merge branch 'main' into merogge/chatWidget3
meganrogge Feb 27, 2024
1cb4a39
Merge branch 'main' into merogge/chatWidget3
meganrogge Mar 4, 2024
0b60cd4
monaco-editor -> monaco-workbench
meganrogge Mar 4, 2024
6cd902f
get progress style to work
meganrogge Mar 4, 2024
d9f62c0
Merge branch 'main' into merogge/chatWidget3
meganrogge Mar 4, 2024
c0b99c0
Update src/vs/workbench/contrib/accessibility/browser/accessibilityCo…
meganrogge Mar 4, 2024
7a7b5ac
rm extra provider id
meganrogge Mar 4, 2024
317d126
use new function call, fix error
meganrogge Mar 4, 2024
f022b12
Move export from terminalContrib lint suppress into terminal/
Tyriar Mar 4, 2024
2fa186f
Merge branch 'main' into merogge/chatWidget3
Tyriar Mar 4, 2024
0818505
rm merge marker, fix css bug
meganrogge Mar 4, 2024
8f06238
fix context key issue for accessible view
meganrogge Mar 4, 2024
1a5e878
Merge remote-tracking branch 'origin/main' into merogge/chatWidget3
Tyriar Mar 6, 2024
1837fba
Add todo for inline chat context key
Tyriar Mar 6, 2024
5fd0172
Fix compile issues
Tyriar Mar 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/vs/platform/terminal/common/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ export const enum TerminalSettingId {
StickyScrollEnabled = 'terminal.integrated.stickyScroll.enabled',
StickyScrollMaxLineCount = 'terminal.integrated.stickyScroll.maxLineCount',
MouseWheelZoom = 'terminal.integrated.mouseWheelZoom',
ExperimentalInlineChat = 'workbench.action.terminal.experimentalInlineChat',

// Debug settings that are hidden from user

Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/browser/parts/panel/media/panelpart.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
border-right-width: 0; /* no border when main editor area is hiden */
}

.monaco-workbench .part.panel > .content .monaco-editor,
.monaco-workbench .part.panel > .content .monaco-editor .margin,
.monaco-workbench .part.panel > .content .monaco-editor .monaco-editor-background {
.monaco-workbench .part.panel > .content .monaco-editor:not(.ignore-panel-bg),
.monaco-workbench .part.panel > .content .monaco-editor:not(.ignore-panel-bg) .margin,
.monaco-workbench .part.panel > .content .monaco-editor:not(.ignore-panel-bg) .monaco-editor-background {
background-color: var(--vscode-panel-background);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const enum AccessibilityVerbositySettingId {
DiffEditor = 'accessibility.verbosity.diffEditor',
Chat = 'accessibility.verbosity.panelChat',
InlineChat = 'accessibility.verbosity.inlineChat',
TerminalChat = 'accessibility.verbosity.terminalChat',
InlineCompletions = 'accessibility.verbosity.inlineCompletions',
KeybindingsEditor = 'accessibility.verbosity.keybindingsEditor',
Notebook = 'accessibility.verbosity.notebook',
Expand All @@ -57,6 +58,7 @@ export const enum AccessibilityVerbositySettingId {

export const enum AccessibleViewProviderId {
Terminal = 'terminal',
TerminalChat = 'terminal-chat',
TerminalHelp = 'terminal-help',
DiffEditor = 'diffEditor',
Chat = 'panelChat',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* Replace with "microphone" icon.
*/
.monaco-workbench .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before,
.monaco-workbench .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before {
.monaco-workbench .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before,
.monaco-workbench .terminal-inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before {
content: "\ec1c";
font-family: 'codicon';
}
Expand All @@ -16,15 +17,17 @@
* Clear animation styles when reduced motion is enabled.
*/
.monaco-workbench.reduce-motion .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled),
.monaco-workbench.reduce-motion .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled) {
.monaco-workbench.reduce-motion .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled),
.monaco-workbench.reduce-motion .terminal-inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled) {
animation: none;
}

/*
* Replace with "stop" icon when reduced motion is enabled.
*/
.monaco-workbench.reduce-motion .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before,
.monaco-workbench.reduce-motion .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before {
.monaco-workbench.reduce-motion .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before,
.monaco-workbench.reduce-motion .terminal-inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before {
content: "\ead7";
font-family: 'codicon';
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,23 @@ import { IVoiceChatService } from 'vs/workbench/contrib/chat/common/voiceChat';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ThemeIcon } from 'vs/base/common/themables';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { ITerminalService } from 'vs/workbench/contrib/terminal/browser/terminal';
import { ProgressLocation } from 'vs/platform/progress/common/progress';
import { TerminalChatController } from 'vs/workbench/contrib/terminal/browser/terminalContribExports';

const CONTEXT_VOICE_CHAT_GETTING_READY = new RawContextKey<boolean>('voiceChatGettingReady', false, { type: 'boolean', description: localize('voiceChatGettingReady', "True when getting ready for receiving voice input from the microphone for voice chat.") });
const CONTEXT_VOICE_CHAT_IN_PROGRESS = new RawContextKey<boolean>('voiceChatInProgress', false, { type: 'boolean', description: localize('voiceChatInProgress', "True when voice recording from microphone is in progress for voice chat.") });

const CONTEXT_QUICK_VOICE_CHAT_IN_PROGRESS = new RawContextKey<boolean>('quickVoiceChatInProgress', false, { type: 'boolean', description: localize('quickVoiceChatInProgress', "True when voice recording from microphone is in progress for quick chat.") });
const CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS = new RawContextKey<boolean>('inlineVoiceChatInProgress', false, { type: 'boolean', description: localize('inlineVoiceChatInProgress', "True when voice recording from microphone is in progress for inline chat.") });
const CONTEXT_TERMINAL_VOICE_CHAT_IN_PROGRESS = new RawContextKey<boolean>('terminalVoiceChatInProgress', false, { type: 'boolean', description: localize('terminalVoiceChatInProgress', "True when voice recording from microphone is in progress for terminal chat.") });
const CONTEXT_VOICE_CHAT_IN_VIEW_IN_PROGRESS = new RawContextKey<boolean>('voiceChatInViewInProgress', false, { type: 'boolean', description: localize('voiceChatInViewInProgress', "True when voice recording from microphone is in progress in the chat view.") });
const CONTEXT_VOICE_CHAT_IN_EDITOR_IN_PROGRESS = new RawContextKey<boolean>('voiceChatInEditorInProgress', false, { type: 'boolean', description: localize('voiceChatInEditorInProgress', "True when voice recording from microphone is in progress in the chat editor.") });

const CanVoiceChat = ContextKeyExpr.and(CONTEXT_PROVIDER_EXISTS, HasSpeechProvider);
const FocusInChatInput = assertIsDefined(ContextKeyExpr.or(CTX_INLINE_CHAT_FOCUSED, CONTEXT_IN_CHAT_INPUT));

type VoiceChatSessionContext = 'inline' | 'quick' | 'view' | 'editor';
type VoiceChatSessionContext = 'inline' | 'terminal' | 'quick' | 'view' | 'editor';

interface IVoiceChatSessionController {

Expand All @@ -88,14 +91,16 @@ class VoiceChatSessionControllerFactory {
static create(accessor: ServicesAccessor, context: 'quick'): Promise<IVoiceChatSessionController | undefined>;
static create(accessor: ServicesAccessor, context: 'view'): Promise<IVoiceChatSessionController | undefined>;
static create(accessor: ServicesAccessor, context: 'focused'): Promise<IVoiceChatSessionController | undefined>;
static create(accessor: ServicesAccessor, context: 'inline' | 'quick' | 'view' | 'focused'): Promise<IVoiceChatSessionController | undefined>;
static async create(accessor: ServicesAccessor, context: 'inline' | 'quick' | 'view' | 'focused'): Promise<IVoiceChatSessionController | undefined> {
static create(accessor: ServicesAccessor, context: 'terminal'): Promise<IVoiceChatSessionController | undefined>;
static create(accessor: ServicesAccessor, context: 'inline' | 'terminal' | 'quick' | 'view' | 'focused'): Promise<IVoiceChatSessionController | undefined>;
static async create(accessor: ServicesAccessor, context: 'inline' | 'terminal' | 'quick' | 'view' | 'focused'): Promise<IVoiceChatSessionController | undefined> {
const chatWidgetService = accessor.get(IChatWidgetService);
const viewsService = accessor.get(IViewsService);
const chatContributionService = accessor.get(IChatContributionService);
const quickChatService = accessor.get(IQuickChatService);
const layoutService = accessor.get(IWorkbenchLayoutService);
const editorService = accessor.get(IEditorService);
const terminalService = accessor.get(ITerminalService);

// Currently Focused Context
if (context === 'focused') {
Expand Down Expand Up @@ -130,6 +135,15 @@ class VoiceChatSessionControllerFactory {
return VoiceChatSessionControllerFactory.doCreateForInlineChat(inlineChat);
}
}

// Try with the terminal chat
const activeInstance = terminalService.activeInstance;
if (activeInstance) {
const terminalChat = TerminalChatController.activeChatWidget || TerminalChatController.get(activeInstance);
if (terminalChat?.hasFocus()) {
return VoiceChatSessionControllerFactory.doCreateForTerminalChat(terminalChat);
}
}
}

// View Chat
Expand All @@ -151,6 +165,17 @@ class VoiceChatSessionControllerFactory {
}
}

// Terminal Chat
if (context === 'terminal') {
const activeInstance = terminalService.activeInstance;
if (activeInstance) {
const terminalChat = TerminalChatController.activeChatWidget || TerminalChatController.get(activeInstance);
if (terminalChat) {
return VoiceChatSessionControllerFactory.doCreateForTerminalChat(terminalChat);
}
}
}

// Quick Chat
if (context === 'quick') {
quickChatService.open();
Expand Down Expand Up @@ -231,6 +256,20 @@ class VoiceChatSessionControllerFactory {
clearInputPlaceholder: () => inlineChat.resetPlaceholder()
};
}

private static doCreateForTerminalChat(terminalChat: TerminalChatController): IVoiceChatSessionController {
return {
context: 'terminal',
onDidAcceptInput: terminalChat.onDidAcceptInput,
onDidCancelInput: terminalChat.onDidCancelInput,
focusInput: () => terminalChat.focus(),
acceptInput: () => terminalChat.acceptInput(),
updateInput: text => terminalChat.updateInput(text, false),
getInput: () => terminalChat.getInput(),
setInputPlaceholder: text => terminalChat.setPlaceholder(text),
clearInputPlaceholder: () => terminalChat.resetPlaceholder()
};
}
}

interface IVoiceChatSession {
Expand Down Expand Up @@ -262,6 +301,7 @@ class VoiceChatSessions {

private quickVoiceChatInProgressKey = CONTEXT_QUICK_VOICE_CHAT_IN_PROGRESS.bindTo(this.contextKeyService);
private inlineVoiceChatInProgressKey = CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS.bindTo(this.contextKeyService);
private terminalVoiceChatInProgressKey = CONTEXT_TERMINAL_VOICE_CHAT_IN_PROGRESS.bindTo(this.contextKeyService);
private voiceChatInViewInProgressKey = CONTEXT_VOICE_CHAT_IN_VIEW_IN_PROGRESS.bindTo(this.contextKeyService);
private voiceChatInEditorInProgressKey = CONTEXT_VOICE_CHAT_IN_EDITOR_IN_PROGRESS.bindTo(this.contextKeyService);

Expand Down Expand Up @@ -352,6 +392,9 @@ class VoiceChatSessions {
case 'inline':
this.inlineVoiceChatInProgressKey.set(true);
break;
case 'terminal':
this.terminalVoiceChatInProgressKey.set(true);
break;
case 'quick':
this.quickVoiceChatInProgressKey.set(true);
break;
Expand Down Expand Up @@ -394,6 +437,7 @@ class VoiceChatSessions {

this.quickVoiceChatInProgressKey.set(false);
this.inlineVoiceChatInProgressKey.set(false);
this.terminalVoiceChatInProgressKey.set(false);
this.voiceChatInViewInProgressKey.set(false);
this.voiceChatInEditorInProgressKey.set(false);
}
Expand Down Expand Up @@ -565,7 +609,8 @@ export class StartVoiceChatAction extends Action2 {
CONTEXT_VOICE_CHAT_IN_VIEW_IN_PROGRESS.negate(),
CONTEXT_QUICK_VOICE_CHAT_IN_PROGRESS.negate(),
CONTEXT_VOICE_CHAT_IN_EDITOR_IN_PROGRESS.negate(),
CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS.negate()
CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS.negate(),
CONTEXT_TERMINAL_VOICE_CHAT_IN_PROGRESS.negate()
),
primary: KeyMod.CtrlCmd | KeyCode.KeyI
},
Expand All @@ -581,6 +626,12 @@ export class StartVoiceChatAction extends Action2 {
when: ContextKeyExpr.and(HasSpeechProvider, CONTEXT_INLINE_VOICE_CHAT_IN_PROGRESS.negate()),
group: 'main',
order: -1
},
{
id: MenuId.for('terminalChatInput'),
when: ContextKeyExpr.and(HasSpeechProvider, CONTEXT_TERMINAL_VOICE_CHAT_IN_PROGRESS.negate()),
group: 'main',
order: -1
}]
});
}
Expand Down Expand Up @@ -627,6 +678,11 @@ export class InstallVoiceChatAction extends Action2 {
when: HasSpeechProvider.negate(),
group: 'main',
order: -1
}, {
id: MenuId.for('terminalChatInput'),
when: HasSpeechProvider.negate(),
group: 'main',
order: -1
}]
});
}
Expand All @@ -650,7 +706,7 @@ class BaseStopListeningAction extends Action2 {

constructor(
desc: { id: string; icon?: ThemeIcon; f1?: boolean },
private readonly target: 'inline' | 'quick' | 'view' | 'editor' | undefined,
private readonly target: 'inline' | 'terminal' | 'quick' | 'view' | 'editor' | undefined,
context: RawContextKey<boolean>,
menu: MenuId | undefined,
group: 'navigation' | 'main' = 'navigation'
Expand Down Expand Up @@ -723,6 +779,15 @@ export class StopListeningInInlineChatAction extends BaseStopListeningAction {
}
}

export class StopListeningInTerminalChatAction extends BaseStopListeningAction {

static readonly ID = 'workbench.action.chat.stopListeningInTerminalChat';

constructor() {
super({ id: StopListeningInTerminalChatAction.ID, icon: spinningLoading }, 'terminal', CONTEXT_TERMINAL_VOICE_CHAT_IN_PROGRESS, MenuId.for('terminalChatInput'), 'main');
}
}

export class StopListeningAndSubmitAction extends Action2 {

static readonly ID = 'workbench.action.chat.stopListeningAndSubmit';
Expand Down Expand Up @@ -761,8 +826,29 @@ registerThemingParticipant((theme, collector) => {
// Show a "microphone" icon when recording is in progress that glows via outline.
collector.addRule(`
.monaco-workbench:not(.reduce-motion) .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled),
.monaco-workbench:not(.reduce-motion) .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled) {
.monaco-workbench:not(.reduce-motion) .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled),
.monaco-workbench:not(.reduce-motion) .terminal-inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled) {
color: ${activeRecordingColor};
outline: 1px solid ${activeRecordingColor};
outline-offset: -1px;
animation: pulseAnimation 1s infinite;
border-radius: 50%;
}

.monaco-workbench:not(.reduce-motion) .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before,
.monaco-workbench:not(.reduce-motion) .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before,
.monaco-workbench:not(.reduce-motion) .terminal-inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::before {
position: absolute;
outline: 1px solid ${activeRecordingColor};
outline-offset: 2px;
border-radius: 50%;
width: 16px;
height: 16px;
}

.monaco-workbench:not(.reduce-motion) .interactive-input-part .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::after,
.monaco-workbench:not(.reduce-motion) .inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled),
.monaco-workbench:not(.reduce-motion) .terminal-inline-chat .monaco-action-bar .action-label.codicon-loading.codicon-modifier-spin:not(.disabled)::after {
outline: 2px solid ${activeRecordingColor};
outline-offset: -1px;
animation: pulseAnimation 1500ms cubic-bezier(0.75, 0, 0.25, 1) infinite;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { InlineVoiceChatAction, QuickVoiceChatAction, StartVoiceChatAction, StopListeningInInlineChatAction, StopListeningInQuickChatAction, StopListeningInChatEditorAction, StopListeningInChatViewAction, VoiceChatInChatViewAction, StopListeningAction, StopListeningAndSubmitAction, KeywordActivationContribution, InstallVoiceChatAction, HoldToVoiceChatInChatViewAction } from 'vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions';
import { InlineVoiceChatAction, QuickVoiceChatAction, StartVoiceChatAction, StopListeningInInlineChatAction, StopListeningInQuickChatAction, StopListeningInChatEditorAction, StopListeningInChatViewAction, VoiceChatInChatViewAction, StopListeningAction, StopListeningAndSubmitAction, KeywordActivationContribution, InstallVoiceChatAction, StopListeningInTerminalChatAction, HoldToVoiceChatInChatViewAction } from 'vs/workbench/contrib/chat/electron-sandbox/actions/voiceChatActions';
import { registerAction2 } from 'vs/platform/actions/common/actions';
import { WorkbenchPhase, registerWorkbenchContribution2 } from 'vs/workbench/common/contributions';

Expand All @@ -22,5 +22,6 @@ registerAction2(StopListeningInChatViewAction);
registerAction2(StopListeningInChatEditorAction);
registerAction2(StopListeningInQuickChatAction);
registerAction2(StopListeningInInlineChatAction);
registerAction2(StopListeningInTerminalChatAction);

registerWorkbenchContribution2(KeywordActivationContribution.ID, KeywordActivationContribution, WorkbenchPhase.AfterRestored);