mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 19:42:56 +01:00
Use label for the web workers
This commit is contained in:
parent
f57c0d0747
commit
5b4125c325
2 changed files with 6 additions and 2 deletions
|
|
@ -57,7 +57,7 @@ function setupMode(defaults:LanguageServiceDefaultsImpl, modeId:string, language
|
||||||
|
|
||||||
let disposables: IDisposable[] = [];
|
let disposables: IDisposable[] = [];
|
||||||
|
|
||||||
const client = new WorkerManager(defaults);
|
const client = new WorkerManager(modeId, defaults);
|
||||||
disposables.push(client);
|
disposables.push(client);
|
||||||
|
|
||||||
const worker = (first: Uri, ...more: Uri[]): Promise<TypeScriptWorker> => {
|
const worker = (first: Uri, ...more: Uri[]): Promise<TypeScriptWorker> => {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import Uri = monaco.Uri;
|
||||||
|
|
||||||
export class WorkerManager {
|
export class WorkerManager {
|
||||||
|
|
||||||
|
private _modeId: string;
|
||||||
private _defaults: LanguageServiceDefaultsImpl;
|
private _defaults: LanguageServiceDefaultsImpl;
|
||||||
private _idleCheckInterval: number;
|
private _idleCheckInterval: number;
|
||||||
private _lastUsedTime: number;
|
private _lastUsedTime: number;
|
||||||
|
|
@ -21,7 +22,8 @@ export class WorkerManager {
|
||||||
private _worker: monaco.editor.MonacoWebWorker<TypeScriptWorker>;
|
private _worker: monaco.editor.MonacoWebWorker<TypeScriptWorker>;
|
||||||
private _client: Promise<TypeScriptWorker>;
|
private _client: Promise<TypeScriptWorker>;
|
||||||
|
|
||||||
constructor(defaults: LanguageServiceDefaultsImpl) {
|
constructor(modeId:string, defaults: LanguageServiceDefaultsImpl) {
|
||||||
|
this._modeId = modeId;
|
||||||
this._defaults = defaults;
|
this._defaults = defaults;
|
||||||
this._worker = null;
|
this._worker = null;
|
||||||
this._idleCheckInterval = setInterval(() => this._checkIfIdle(), 30 * 1000);
|
this._idleCheckInterval = setInterval(() => this._checkIfIdle(), 30 * 1000);
|
||||||
|
|
@ -63,6 +65,8 @@ export class WorkerManager {
|
||||||
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
// module that exports the create() method and returns a `TypeScriptWorker` instance
|
||||||
moduleId: 'vs/language/typescript/src/worker',
|
moduleId: 'vs/language/typescript/src/worker',
|
||||||
|
|
||||||
|
label: this._modeId,
|
||||||
|
|
||||||
// passed in to the create() method
|
// passed in to the create() method
|
||||||
createData: {
|
createData: {
|
||||||
compilerOptions: this._defaults.getCompilerOptions(),
|
compilerOptions: this._defaults.getCompilerOptions(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue