@codingame/monaco-vscode-speech-service-override 11.1.2 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
+
export default function getServiceOverride(): IEditorOverrideServices;
|
package/index.js
CHANGED
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
3
|
+
import { ISpeechService } from 'vscode/vscode/vs/workbench/contrib/speech/common/speechService.service';
|
|
4
|
+
import { SpeechService } from './vscode/src/vs/workbench/contrib/speech/browser/speechService.js';
|
|
5
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
6
|
+
|
|
7
|
+
function getServiceOverride() {
|
|
8
|
+
return {
|
|
9
|
+
[ISpeechService.toString()]: new SyncDescriptor(SpeechService, [], true)
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-speech-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - speech service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,11 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.1"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {},
|
|
21
|
+
"peerDependenciesMeta": {},
|
|
17
22
|
"main": "index.js",
|
|
18
23
|
"module": "index.js",
|
|
19
24
|
"types": "index.d.ts",
|
|
@@ -22,10 +27,12 @@
|
|
|
22
27
|
"default": "./index.js"
|
|
23
28
|
},
|
|
24
29
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
30
|
+
"default": "./vscode/src/*.js",
|
|
31
|
+
"types": "./vscode/src/*.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./*": {
|
|
34
|
+
"default": "./*.js",
|
|
35
|
+
"types": "./*.d.ts"
|
|
26
36
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.2"
|
|
30
37
|
}
|
|
31
38
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CancellationToken } from "vscode/vscode/vs/base/common/cancellation";
|
|
2
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
3
|
+
import { Disposable, IDisposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
4
|
+
import { IContextKeyService } from "vscode/vscode/vs/platform/contextkey/common/contextkey.service";
|
|
5
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
6
|
+
import { IHostService } from "vscode/vscode/vs/workbench/services/host/browser/host.service";
|
|
7
|
+
import { ISpeechProvider, ISpeechToTextSession, KeywordRecognitionStatus, ITextToSpeechSession } from "vscode/vscode/vs/workbench/contrib/speech/common/speechService";
|
|
8
|
+
import { ISpeechService } from "vscode/vscode/vs/workbench/contrib/speech/common/speechService.service";
|
|
9
|
+
import { ITelemetryService } from "vscode/vscode/vs/platform/telemetry/common/telemetry.service";
|
|
10
|
+
import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
|
|
11
|
+
import { IExtensionService } from "vscode/vscode/vs/workbench/services/extensions/common/extensions.service";
|
|
12
|
+
export interface ISpeechProviderDescriptor {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly description?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class SpeechService extends Disposable implements ISpeechService {
|
|
17
|
+
private readonly logService;
|
|
18
|
+
private readonly contextKeyService;
|
|
19
|
+
private readonly hostService;
|
|
20
|
+
private readonly telemetryService;
|
|
21
|
+
private readonly configurationService;
|
|
22
|
+
private readonly extensionService;
|
|
23
|
+
readonly _serviceBrand: undefined;
|
|
24
|
+
private readonly _onDidChangeHasSpeechProvider;
|
|
25
|
+
readonly onDidChangeHasSpeechProvider: Event<void>;
|
|
26
|
+
get hasSpeechProvider(): boolean;
|
|
27
|
+
private readonly providers;
|
|
28
|
+
private readonly providerDescriptors;
|
|
29
|
+
private readonly hasSpeechProviderContext;
|
|
30
|
+
constructor(logService: ILogService, contextKeyService: IContextKeyService, hostService: IHostService, telemetryService: ITelemetryService, configurationService: IConfigurationService, extensionService: IExtensionService);
|
|
31
|
+
private handleAndRegisterSpeechExtensions;
|
|
32
|
+
registerSpeechProvider(identifier: string, provider: ISpeechProvider): IDisposable;
|
|
33
|
+
private handleHasSpeechProviderChange;
|
|
34
|
+
private readonly _onDidStartSpeechToTextSession;
|
|
35
|
+
readonly onDidStartSpeechToTextSession: Event<void>;
|
|
36
|
+
private readonly _onDidEndSpeechToTextSession;
|
|
37
|
+
readonly onDidEndSpeechToTextSession: Event<void>;
|
|
38
|
+
private activeSpeechToTextSessions;
|
|
39
|
+
get hasActiveSpeechToTextSession(): boolean;
|
|
40
|
+
private readonly speechToTextInProgress;
|
|
41
|
+
createSpeechToTextSession(token: CancellationToken, context?: string): Promise<ISpeechToTextSession>;
|
|
42
|
+
private getProvider;
|
|
43
|
+
private readonly _onDidStartTextToSpeechSession;
|
|
44
|
+
readonly onDidStartTextToSpeechSession: Event<void>;
|
|
45
|
+
private readonly _onDidEndTextToSpeechSession;
|
|
46
|
+
readonly onDidEndTextToSpeechSession: Event<void>;
|
|
47
|
+
private activeTextToSpeechSessions;
|
|
48
|
+
get hasActiveTextToSpeechSession(): boolean;
|
|
49
|
+
private readonly textToSpeechInProgress;
|
|
50
|
+
createTextToSpeechSession(token: CancellationToken, context?: string): Promise<ITextToSpeechSession>;
|
|
51
|
+
private readonly _onDidStartKeywordRecognition;
|
|
52
|
+
readonly onDidStartKeywordRecognition: Event<void>;
|
|
53
|
+
private readonly _onDidEndKeywordRecognition;
|
|
54
|
+
readonly onDidEndKeywordRecognition: Event<void>;
|
|
55
|
+
private activeKeywordRecognitionSessions;
|
|
56
|
+
get hasActiveKeywordRecognition(): boolean;
|
|
57
|
+
recognizeKeyword(token: CancellationToken): Promise<KeywordRecognitionStatus>;
|
|
58
|
+
private doRecognizeKeyword;
|
|
59
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
4
|
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
4
5
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
@@ -16,7 +17,7 @@ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extension
|
|
|
16
17
|
const speechProvidersExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
17
18
|
extensionPoint: 'speechProviders',
|
|
18
19
|
jsonSchema: {
|
|
19
|
-
description: ( localize(
|
|
20
|
+
description: ( localize(8911, 'Contributes a Speech Provider')),
|
|
20
21
|
type: 'array',
|
|
21
22
|
items: {
|
|
22
23
|
additionalProperties: false,
|
|
@@ -25,11 +26,11 @@ const speechProvidersExtensionPoint = ExtensionsRegistry.registerExtensionPoint(
|
|
|
25
26
|
required: ['name'],
|
|
26
27
|
properties: {
|
|
27
28
|
name: {
|
|
28
|
-
description: ( localize(
|
|
29
|
+
description: ( localize(8912, "Unique name for this Speech Provider.")),
|
|
29
30
|
type: 'string'
|
|
30
31
|
},
|
|
31
32
|
description: {
|
|
32
|
-
description: ( localize(
|
|
33
|
+
description: ( localize(8913, "A description of this Speech Provider, shown in the UI.")),
|
|
33
34
|
type: 'string'
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -46,26 +47,26 @@ let SpeechService = class SpeechService extends Disposable {
|
|
|
46
47
|
this.telemetryService = telemetryService;
|
|
47
48
|
this.configurationService = configurationService;
|
|
48
49
|
this.extensionService = extensionService;
|
|
49
|
-
this._onDidChangeHasSpeechProvider = this._register((
|
|
50
|
+
this._onDidChangeHasSpeechProvider = this._register(( new Emitter()));
|
|
50
51
|
this.onDidChangeHasSpeechProvider = this._onDidChangeHasSpeechProvider.event;
|
|
51
|
-
this.providers = (
|
|
52
|
-
this.providerDescriptors = (
|
|
52
|
+
this.providers = ( new Map());
|
|
53
|
+
this.providerDescriptors = ( new Map());
|
|
53
54
|
this.hasSpeechProviderContext = HasSpeechProvider.bindTo(this.contextKeyService);
|
|
54
|
-
this._onDidStartSpeechToTextSession = this._register((
|
|
55
|
+
this._onDidStartSpeechToTextSession = this._register(( new Emitter()));
|
|
55
56
|
this.onDidStartSpeechToTextSession = this._onDidStartSpeechToTextSession.event;
|
|
56
|
-
this._onDidEndSpeechToTextSession = this._register((
|
|
57
|
+
this._onDidEndSpeechToTextSession = this._register(( new Emitter()));
|
|
57
58
|
this.onDidEndSpeechToTextSession = this._onDidEndSpeechToTextSession.event;
|
|
58
59
|
this.activeSpeechToTextSessions = 0;
|
|
59
60
|
this.speechToTextInProgress = SpeechToTextInProgress.bindTo(this.contextKeyService);
|
|
60
|
-
this._onDidStartTextToSpeechSession = this._register((
|
|
61
|
+
this._onDidStartTextToSpeechSession = this._register(( new Emitter()));
|
|
61
62
|
this.onDidStartTextToSpeechSession = this._onDidStartTextToSpeechSession.event;
|
|
62
|
-
this._onDidEndTextToSpeechSession = this._register((
|
|
63
|
+
this._onDidEndTextToSpeechSession = this._register(( new Emitter()));
|
|
63
64
|
this.onDidEndTextToSpeechSession = this._onDidEndTextToSpeechSession.event;
|
|
64
65
|
this.activeTextToSpeechSessions = 0;
|
|
65
66
|
this.textToSpeechInProgress = TextToSpeechInProgress.bindTo(this.contextKeyService);
|
|
66
|
-
this._onDidStartKeywordRecognition = this._register((
|
|
67
|
+
this._onDidStartKeywordRecognition = this._register(( new Emitter()));
|
|
67
68
|
this.onDidStartKeywordRecognition = this._onDidStartKeywordRecognition.event;
|
|
68
|
-
this._onDidEndKeywordRecognition = this._register((
|
|
69
|
+
this._onDidEndKeywordRecognition = this._register(( new Emitter()));
|
|
69
70
|
this.onDidEndKeywordRecognition = this._onDidEndKeywordRecognition.event;
|
|
70
71
|
this.activeKeywordRecognitionSessions = 0;
|
|
71
72
|
this.handleAndRegisterSpeechExtensions();
|
|
@@ -89,8 +90,8 @@ let SpeechService = class SpeechService extends Disposable {
|
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
registerSpeechProvider(identifier, provider) {
|
|
92
|
-
if ((
|
|
93
|
-
throw (
|
|
93
|
+
if (( this.providers.has(identifier))) {
|
|
94
|
+
throw ( new Error(`Speech provider with identifier ${identifier} is already registered.`));
|
|
94
95
|
}
|
|
95
96
|
const oldHasSpeechProvider = this.hasSpeechProvider;
|
|
96
97
|
this.providers.set(identifier, provider);
|
|
@@ -118,7 +119,7 @@ let SpeechService = class SpeechService extends Disposable {
|
|
|
118
119
|
let sessionRecognized = false;
|
|
119
120
|
let sessionError = false;
|
|
120
121
|
let sessionContentLength = 0;
|
|
121
|
-
const disposables = (
|
|
122
|
+
const disposables = ( new DisposableStore());
|
|
122
123
|
const onSessionStoppedOrCanceled = () => {
|
|
123
124
|
this.activeSpeechToTextSessions = Math.max(0, this.activeSpeechToTextSessions - 1);
|
|
124
125
|
if (!this.hasActiveSpeechToTextSession) {
|
|
@@ -167,9 +168,9 @@ let SpeechService = class SpeechService extends Disposable {
|
|
|
167
168
|
}
|
|
168
169
|
async getProvider() {
|
|
169
170
|
await this.extensionService.activateByEvent('onSpeech');
|
|
170
|
-
const provider = Array.from((
|
|
171
|
+
const provider = Array.from(( this.providers.values())).at(0);
|
|
171
172
|
if (!provider) {
|
|
172
|
-
throw (
|
|
173
|
+
throw ( new Error(`No Speech provider is registered.`));
|
|
173
174
|
}
|
|
174
175
|
else if (this.providers.size > 1) {
|
|
175
176
|
this.logService.warn(`Multiple speech providers registered. Picking first one: ${provider.metadata.displayName}`);
|
|
@@ -183,7 +184,7 @@ let SpeechService = class SpeechService extends Disposable {
|
|
|
183
184
|
const session = provider.createTextToSpeechSession(token, typeof language === 'string' ? { language } : undefined);
|
|
184
185
|
const sessionStart = Date.now();
|
|
185
186
|
let sessionError = false;
|
|
186
|
-
const disposables = (
|
|
187
|
+
const disposables = ( new DisposableStore());
|
|
187
188
|
const onSessionStoppedOrCanceled = (dispose) => {
|
|
188
189
|
this.activeTextToSpeechSessions = Math.max(0, this.activeTextToSpeechSessions - 1);
|
|
189
190
|
if (!this.hasActiveTextToSpeechSession) {
|
|
@@ -224,17 +225,17 @@ let SpeechService = class SpeechService extends Disposable {
|
|
|
224
225
|
}
|
|
225
226
|
get hasActiveKeywordRecognition() { return this.activeKeywordRecognitionSessions > 0; }
|
|
226
227
|
async recognizeKeyword(token) {
|
|
227
|
-
const result = (
|
|
228
|
-
const disposables = (
|
|
228
|
+
const result = ( new DeferredPromise());
|
|
229
|
+
const disposables = ( new DisposableStore());
|
|
229
230
|
disposables.add(token.onCancellationRequested(() => {
|
|
230
231
|
disposables.dispose();
|
|
231
232
|
result.complete(KeywordRecognitionStatus.Canceled);
|
|
232
233
|
}));
|
|
233
|
-
const recognizeKeywordDisposables = disposables.add((
|
|
234
|
+
const recognizeKeywordDisposables = disposables.add(( new DisposableStore()));
|
|
234
235
|
let activeRecognizeKeywordSession = undefined;
|
|
235
236
|
const recognizeKeyword = () => {
|
|
236
237
|
recognizeKeywordDisposables.clear();
|
|
237
|
-
const cts = (
|
|
238
|
+
const cts = ( new CancellationTokenSource(token));
|
|
238
239
|
recognizeKeywordDisposables.add(toDisposable(() => cts.dispose(true)));
|
|
239
240
|
const currentRecognizeKeywordSession = activeRecognizeKeywordSession = this.doRecognizeKeyword(cts.token).then(status => {
|
|
240
241
|
if (currentRecognizeKeywordSession === activeRecognizeKeywordSession) {
|
|
@@ -275,7 +276,7 @@ let SpeechService = class SpeechService extends Disposable {
|
|
|
275
276
|
const session = provider.createKeywordRecognitionSession(token);
|
|
276
277
|
this.activeKeywordRecognitionSessions++;
|
|
277
278
|
this._onDidStartKeywordRecognition.fire();
|
|
278
|
-
const disposables = (
|
|
279
|
+
const disposables = ( new DisposableStore());
|
|
279
280
|
const onSessionStoppedOrCanceled = () => {
|
|
280
281
|
this.activeKeywordRecognitionSessions = Math.max(0, this.activeKeywordRecognitionSessions - 1);
|
|
281
282
|
this._onDidEndKeywordRecognition.fire();
|
|
@@ -298,13 +299,13 @@ let SpeechService = class SpeechService extends Disposable {
|
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
301
|
};
|
|
301
|
-
SpeechService = (
|
|
302
|
-
(
|
|
303
|
-
(
|
|
304
|
-
(
|
|
305
|
-
(
|
|
306
|
-
(
|
|
307
|
-
(
|
|
308
|
-
], SpeechService))
|
|
302
|
+
SpeechService = ( __decorate([
|
|
303
|
+
( __param(0, ILogService)),
|
|
304
|
+
( __param(1, IContextKeyService)),
|
|
305
|
+
( __param(2, IHostService)),
|
|
306
|
+
( __param(3, ITelemetryService)),
|
|
307
|
+
( __param(4, IConfigurationService)),
|
|
308
|
+
( __param(5, IExtensionService))
|
|
309
|
+
], SpeechService));
|
|
309
310
|
|
|
310
311
|
export { SpeechService };
|
package/speech.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
-
import { ISpeechService } from 'vscode/vscode/vs/workbench/contrib/speech/common/speechService.service';
|
|
3
|
-
import { SpeechService } from './vscode/src/vs/workbench/contrib/speech/browser/speechService.js';
|
|
4
|
-
|
|
5
|
-
function getServiceOverride() {
|
|
6
|
-
return {
|
|
7
|
-
[( ISpeechService.toString())]: new SyncDescriptor(SpeechService, [], true)
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { getServiceOverride as default };
|