@@ -16,6 +16,7 @@ import { ILogService } from 'vs/platform/log/common/log';
16
16
export const ISpeechService = createDecorator < ISpeechService > ( 'speechService' ) ;
17
17
18
18
export const HasSpeechProvider = new RawContextKey < boolean > ( 'hasSpeechProvider' , false , { type : 'string' , description : localize ( 'hasSpeechProvider' , "A speech provider is registered to the speech service." ) } ) ;
19
+ export const SpeechInProgress = new RawContextKey < boolean > ( 'speechInProgress' , false , { type : 'string' , description : localize ( 'speechInProgress' , "A speech session is in progress." ) } ) ;
19
20
20
21
export interface ISpeechProviderMetadata {
21
22
readonly extension : ExtensionIdentifier ;
@@ -109,12 +110,21 @@ export class SpeechService extends Disposable implements ISpeechService {
109
110
private readonly providers = new Map < string , ISpeechProvider > ( ) ;
110
111
111
112
private readonly hasSpeechProviderContext = HasSpeechProvider . bindTo ( this . contextKeyService ) ;
113
+ private readonly speechInProgress = SpeechInProgress . bindTo ( this . contextKeyService ) ;
114
+
115
+ private readonly _onDidStartSpeechToTextSession = this . _register ( new Emitter < void > ( ) ) ;
116
+ readonly onDidStartSpeechToTextSession = this . _onDidStartSpeechToTextSession . event ;
117
+
118
+ private readonly _onDidEndSpeechToTextSession = this . _register ( new Emitter < void > ( ) ) ;
119
+ readonly onDidEndSpeechToTextSession = this . _onDidEndSpeechToTextSession . event ;
112
120
113
121
constructor (
114
122
@ILogService private readonly logService : ILogService ,
115
123
@IContextKeyService private readonly contextKeyService : IContextKeyService
116
124
) {
117
125
super ( ) ;
126
+ this . _register ( this . onDidStartSpeechToTextSession ( ( ) => this . speechInProgress . set ( true ) ) ) ;
127
+ this . _register ( this . onDidEndSpeechToTextSession ( ( ) => this . speechInProgress . reset ( ) ) ) ;
118
128
}
119
129
120
130
registerSpeechProvider ( identifier : string , provider : ISpeechProvider ) : IDisposable {
@@ -137,11 +147,6 @@ export class SpeechService extends Disposable implements ISpeechService {
137
147
} ) ;
138
148
}
139
149
140
- private readonly _onDidStartSpeechToTextSession = this . _register ( new Emitter < void > ( ) ) ;
141
- readonly onDidStartSpeechToTextSession = this . _onDidStartSpeechToTextSession . event ;
142
-
143
- private readonly _onDidEndSpeechToTextSession = this . _register ( new Emitter < void > ( ) ) ;
144
- readonly onDidEndSpeechToTextSession = this . _onDidEndSpeechToTextSession . event ;
145
150
146
151
private _activeSpeechToTextSession : ISpeechToTextSession | undefined = undefined ;
147
152
get hasActiveSpeechToTextSession ( ) { return ! ! this . _activeSpeechToTextSession ; }
0 commit comments