mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 04:49:35 +00:00
fix #203197
This commit is contained in:
parent
09231caec0
commit
8e5d9da1e4
|
@ -16,6 +16,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||
export const ISpeechService = createDecorator<ISpeechService>('speechService');
|
||||
|
||||
export const HasSpeechProvider = new RawContextKey<boolean>('hasSpeechProvider', false, { type: 'string', description: localize('hasSpeechProvider', "A speech provider is registered to the speech service.") });
|
||||
export const SpeechInProgress = new RawContextKey<boolean>('speechInProgress', false, { type: 'string', description: localize('speechInProgress', "A speech session is in progress.") });
|
||||
|
||||
export interface ISpeechProviderMetadata {
|
||||
readonly extension: ExtensionIdentifier;
|
||||
|
@ -109,12 +110,21 @@ export class SpeechService extends Disposable implements ISpeechService {
|
|||
private readonly providers = new Map<string, ISpeechProvider>();
|
||||
|
||||
private readonly hasSpeechProviderContext = HasSpeechProvider.bindTo(this.contextKeyService);
|
||||
private readonly speechInProgress = SpeechInProgress.bindTo(this.contextKeyService);
|
||||
|
||||
private readonly _onDidStartSpeechToTextSession = this._register(new Emitter<void>());
|
||||
readonly onDidStartSpeechToTextSession = this._onDidStartSpeechToTextSession.event;
|
||||
|
||||
private readonly _onDidEndSpeechToTextSession = this._register(new Emitter<void>());
|
||||
readonly onDidEndSpeechToTextSession = this._onDidEndSpeechToTextSession.event;
|
||||
|
||||
constructor(
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@IContextKeyService private readonly contextKeyService: IContextKeyService
|
||||
) {
|
||||
super();
|
||||
this._register(this.onDidStartSpeechToTextSession(() => this.speechInProgress.set(true)));
|
||||
this._register(this.onDidEndSpeechToTextSession(() => this.speechInProgress.reset()));
|
||||
}
|
||||
|
||||
registerSpeechProvider(identifier: string, provider: ISpeechProvider): IDisposable {
|
||||
|
@ -137,11 +147,6 @@ export class SpeechService extends Disposable implements ISpeechService {
|
|||
});
|
||||
}
|
||||
|
||||
private readonly _onDidStartSpeechToTextSession = this._register(new Emitter<void>());
|
||||
readonly onDidStartSpeechToTextSession = this._onDidStartSpeechToTextSession.event;
|
||||
|
||||
private readonly _onDidEndSpeechToTextSession = this._register(new Emitter<void>());
|
||||
readonly onDidEndSpeechToTextSession = this._onDidEndSpeechToTextSession.event;
|
||||
|
||||
private _activeSpeechToTextSession: ISpeechToTextSession | undefined = undefined;
|
||||
get hasActiveSpeechToTextSession() { return !!this._activeSpeechToTextSession; }
|
||||
|
|
Loading…
Reference in a new issue