better precondition, enable commands to appear in command pallette

This commit is contained in:
meganrogge
2024-01-16 11:34:21 -08:00
parent 70575102e7
commit 7efe326c49
@@ -1644,30 +1644,29 @@ export function registerTerminalActions() {
}
});
registerTerminalAction({
registerActiveInstanceAction({
id: TerminalCommandId.StartSpeechToText,
title: {
value: localize('workbench.action.startTerminalSpeechToText', "Start Terminal Speech To Text"),
original: 'Start Terminal Speech To Text'
},
precondition: ContextKeyExpr.and(HasSpeechProvider, TerminalContextKeys.focus),
precondition: ContextKeyExpr.and(HasSpeechProvider, sharedWhenClause.terminalAvailable),
f1: true,
run: (c, accessor) => {
run: (activeInstance, c, accessor) => {
const instantiationService = accessor.get(IInstantiationService);
TerminalVoiceSession.getInstance(instantiationService).start();
}
});
registerTerminalAction({
registerActiveInstanceAction({
id: TerminalCommandId.StopSpeechToText,
title: {
value: localize('workbench.action.stopTerminalSpeechToText', "Stop Terminal Speech To Text"),
original: 'Stop Terminal Speech To Text'
},
precondition: ContextKeyExpr.and(HasSpeechProvider, TerminalContextKeys.focus),
precondition: ContextKeyExpr.and(HasSpeechProvider, sharedWhenClause.terminalAvailable),
f1: true,
run: (c, accessor) => {
run: (activeInstance, c, accessor) => {
const instantiationService = accessor.get(IInstantiationService);
TerminalVoiceSession.getInstance(instantiationService).stop(true);
}