mirror of https://github.com/microsoft/vscode.git
`EditorSimpleWorker` -> `EditorWebWorker`
This commit is contained in:
parent
7be14b9562
commit
c36caf1bf7
|
@ -19,10 +19,10 @@ function createModuleDescription(name, exclude) {
|
|||
* @param {string} name
|
||||
*/
|
||||
function createEditorWorkerModuleDescription(name) {
|
||||
return createModuleDescription(name, ['vs/base/common/worker/webWorker', 'vs/editor/common/services/editorSimpleWorker']);
|
||||
return createModuleDescription(name, ['vs/base/common/worker/webWorker', 'vs/editor/common/services/editorWebWorker']);
|
||||
}
|
||||
|
||||
exports.workerEditor = createEditorWorkerModuleDescription('vs/editor/common/services/editorSimpleWorkerMain');
|
||||
exports.workerEditor = createEditorWorkerModuleDescription('vs/editor/common/services/editorWebWorkerMain');
|
||||
exports.workerExtensionHost = createEditorWorkerModuleDescription('vs/workbench/api/worker/extensionHostWorkerMain');
|
||||
exports.workerNotebook = createEditorWorkerModuleDescription('vs/workbench/contrib/notebook/common/services/notebookWebWorkerMain');
|
||||
exports.workerLanguageDetection = createEditorWorkerModuleDescription('vs/workbench/services/languageDetection/browser/languageDetectionWebWorkerMain');
|
||||
|
|
|
@ -43,7 +43,7 @@ const extractEditorSrcTask = task.define('extract-editor-src', () => {
|
|||
entryPoints: [
|
||||
'vs/editor/editor.main',
|
||||
'vs/editor/editor.worker.start',
|
||||
'vs/editor/common/services/editorSimpleWorkerMain',
|
||||
'vs/editor/common/services/editorWebWorkerMain',
|
||||
],
|
||||
inlineEntryPoints: [
|
||||
apiusages,
|
||||
|
|
|
@ -145,7 +145,7 @@ declare namespace monaco.languages {
|
|||
declare namespace monaco.worker {
|
||||
|
||||
#include(vs/editor/common/model/mirrorTextModel): IMirrorTextModel
|
||||
#includeAll(vs/editor/common/services/editorSimpleWorker;):
|
||||
#includeAll(vs/editor/common/services/editorWebWorker;):
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import { IRange, Range } from '../../common/core/range.js';
|
|||
import { ITextModel } from '../../common/model.js';
|
||||
import * as languages from '../../common/languages.js';
|
||||
import { ILanguageConfigurationService } from '../../common/languages/languageConfigurationRegistry.js';
|
||||
import { EditorSimpleWorker } from '../../common/services/editorSimpleWorker.js';
|
||||
import { EditorWorker } from '../../common/services/editorWebWorker.js';
|
||||
import { DiffAlgorithmName, IEditorWorkerService, ILineChange, IUnicodeHighlightsResult } from '../../common/services/editorWorker.js';
|
||||
import { IModelService } from '../../common/services/model.js';
|
||||
import { ITextResourceConfigurationService } from '../../common/services/textResourceConfiguration.js';
|
||||
|
@ -222,7 +222,7 @@ export abstract class EditorWorkerService extends Disposable implements IEditorW
|
|||
return worker.$computeDefaultDocumentColors(uri.toString());
|
||||
}
|
||||
|
||||
private async _workerWithResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorSimpleWorker>> {
|
||||
private async _workerWithResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {
|
||||
const worker = await this._workerManager.withWorker();
|
||||
return await worker.workerWithSyncedResources(resources, forceLargeModels);
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ export class EditorWorkerClient extends Disposable implements IEditorWorkerClien
|
|||
|
||||
private readonly _modelService: IModelService;
|
||||
private readonly _keepIdleModels: boolean;
|
||||
private _worker: IWebWorkerClient<EditorSimpleWorker> | null;
|
||||
private _worker: IWebWorkerClient<EditorWorker> | null;
|
||||
private _modelManager: WorkerTextModelSyncClient | null;
|
||||
private _disposed = false;
|
||||
|
||||
|
@ -426,10 +426,10 @@ export class EditorWorkerClient extends Disposable implements IEditorWorkerClien
|
|||
throw new Error(`Not implemented!`);
|
||||
}
|
||||
|
||||
private _getOrCreateWorker(): IWebWorkerClient<EditorSimpleWorker> {
|
||||
private _getOrCreateWorker(): IWebWorkerClient<EditorWorker> {
|
||||
if (!this._worker) {
|
||||
try {
|
||||
this._worker = this._register(createWebWorker<EditorSimpleWorker>(this._workerDescriptorOrWorker));
|
||||
this._worker = this._register(createWebWorker<EditorWorker>(this._workerDescriptorOrWorker));
|
||||
EditorWorkerHost.setChannel(this._worker, this._createEditorWorkerHost());
|
||||
} catch (err) {
|
||||
logOnceWebWorkerWarning(err);
|
||||
|
@ -439,7 +439,7 @@ export class EditorWorkerClient extends Disposable implements IEditorWorkerClien
|
|||
return this._worker;
|
||||
}
|
||||
|
||||
protected async _getProxy(): Promise<Proxied<EditorSimpleWorker>> {
|
||||
protected async _getProxy(): Promise<Proxied<EditorWorker>> {
|
||||
try {
|
||||
const proxy = this._getOrCreateWorker().proxy;
|
||||
await proxy.$ping();
|
||||
|
@ -451,8 +451,8 @@ export class EditorWorkerClient extends Disposable implements IEditorWorkerClien
|
|||
}
|
||||
}
|
||||
|
||||
private _createFallbackLocalWorker(): SynchronousWorkerClient<EditorSimpleWorker> {
|
||||
return new SynchronousWorkerClient(new EditorSimpleWorker(null));
|
||||
private _createFallbackLocalWorker(): SynchronousWorkerClient<EditorWorker> {
|
||||
return new SynchronousWorkerClient(new EditorWorker(null));
|
||||
}
|
||||
|
||||
private _createEditorWorkerHost(): EditorWorkerHost {
|
||||
|
@ -461,14 +461,14 @@ export class EditorWorkerClient extends Disposable implements IEditorWorkerClien
|
|||
};
|
||||
}
|
||||
|
||||
private _getOrCreateModelManager(proxy: Proxied<EditorSimpleWorker>): WorkerTextModelSyncClient {
|
||||
private _getOrCreateModelManager(proxy: Proxied<EditorWorker>): WorkerTextModelSyncClient {
|
||||
if (!this._modelManager) {
|
||||
this._modelManager = this._register(new WorkerTextModelSyncClient(proxy, this._modelService, this._keepIdleModels));
|
||||
}
|
||||
return this._modelManager;
|
||||
}
|
||||
|
||||
public async workerWithSyncedResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorSimpleWorker>> {
|
||||
public async workerWithSyncedResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {
|
||||
if (this._disposed) {
|
||||
return Promise.reject(canceled());
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ export interface IWordRange {
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
export class EditorSimpleWorker implements IDisposable, IWorkerTextModelSyncChannelServer, IWebWorkerServerRequestHandler {
|
||||
export class EditorWorker implements IDisposable, IWorkerTextModelSyncChannelServer, IWebWorkerServerRequestHandler {
|
||||
_requestHandlerBrand: any;
|
||||
|
||||
private readonly _workerTextModelSyncServer = new WorkerTextModelSyncServer();
|
||||
|
@ -125,7 +125,7 @@ export class EditorSimpleWorker implements IDisposable, IWorkerTextModelSyncChan
|
|||
return null;
|
||||
}
|
||||
|
||||
const result = EditorSimpleWorker.computeDiff(original, modified, options, algorithm);
|
||||
const result = EditorWorker.computeDiff(original, modified, options, algorithm);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ export class EditorSimpleWorker implements IDisposable, IWorkerTextModelSyncChan
|
|||
}
|
||||
|
||||
// make sure diff won't take too long
|
||||
if (Math.max(text.length, original.length) > EditorSimpleWorker._diffLimit) {
|
||||
if (Math.max(text.length, original.length) > EditorWorker._diffLimit) {
|
||||
result.push({ range, text });
|
||||
continue;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ export class EditorSimpleWorker implements IDisposable, IWorkerTextModelSyncChan
|
|||
}
|
||||
|
||||
// make sure diff won't take too long
|
||||
if (Math.max(text.length, original.length) > EditorSimpleWorker._diffLimit) {
|
||||
if (Math.max(text.length, original.length) > EditorWorker._diffLimit) {
|
||||
result.push({ range, text });
|
||||
continue;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ export class EditorSimpleWorker implements IDisposable, IWorkerTextModelSyncChan
|
|||
continue;
|
||||
}
|
||||
seen.add(word);
|
||||
if (seen.size > EditorSimpleWorker._suggestionsLimit) {
|
||||
if (seen.size > EditorWorker._suggestionsLimit) {
|
||||
break outer;
|
||||
}
|
||||
}
|
|
@ -4,6 +4,6 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { bootstrapWebWorker } from '../../../base/common/worker/webWorkerBootstrap.js';
|
||||
import { EditorSimpleWorker } from './editorSimpleWorker.js';
|
||||
import { EditorWorker } from './editorWebWorker.js';
|
||||
|
||||
bootstrapWebWorker(() => new EditorSimpleWorker(null));
|
||||
bootstrapWebWorker(() => new EditorWorker(null));
|
|
@ -10,7 +10,7 @@ import { IChange } from '../diff/legacyLinesDiffComputer.js';
|
|||
import { IColorInformation, IInplaceReplaceSupportResult, TextEdit } from '../languages.js';
|
||||
import { UnicodeHighlighterOptions } from './unicodeTextModelHighlighter.js';
|
||||
import { createDecorator } from '../../../platform/instantiation/common/instantiation.js';
|
||||
import type { EditorSimpleWorker } from './editorSimpleWorker.js';
|
||||
import type { EditorWorker } from './editorWebWorker.js';
|
||||
import { SectionHeader, FindSectionHeaderOptions } from './findSectionHeaders.js';
|
||||
|
||||
export const IEditorWorkerService = createDecorator<IEditorWorkerService>('editorWorkerService');
|
||||
|
@ -23,7 +23,7 @@ export interface IEditorWorkerService {
|
|||
canComputeUnicodeHighlights(uri: URI): boolean;
|
||||
computedUnicodeHighlights(uri: URI, options: UnicodeHighlighterOptions, range?: IRange): Promise<IUnicodeHighlightsResult>;
|
||||
|
||||
/** Implementation in {@link EditorSimpleWorker.computeDiff} */
|
||||
/** Implementation in {@link EditorWorker.computeDiff} */
|
||||
computeDiff(original: URI, modified: URI, options: IDocumentDiffProviderOptions, algorithm: DiffAlgorithmName): Promise<IDocumentDiff | null>;
|
||||
|
||||
canComputeDirtyDiff(original: URI, modified: URI): boolean;
|
||||
|
|
|
@ -13,7 +13,7 @@ import { ensureValidWordDefinition, getWordAtText, IWordAtPosition } from '../..
|
|||
import { IDocumentColorComputerTarget } from '../../languages/defaultDocumentColorsComputer.js';
|
||||
import { ILinkComputerTarget } from '../../languages/linkComputer.js';
|
||||
import { MirrorTextModel as BaseMirrorModel, IModelChangedEvent } from '../../model/mirrorTextModel.js';
|
||||
import { IMirrorModel, IWordRange } from '../editorSimpleWorker.js';
|
||||
import { IMirrorModel, IWordRange } from '../editorWebWorker.js';
|
||||
import { IModelService } from '../model.js';
|
||||
import { IRawModelData, IWorkerTextModelSyncChannelServer } from './textModelSync.protocol.js';
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import { IRange } from '../../../../common/core/range.js';
|
|||
import { DEFAULT_WORD_REGEXP } from '../../../../common/core/wordHelper.js';
|
||||
import * as languages from '../../../../common/languages.js';
|
||||
import { ILanguageConfigurationService } from '../../../../common/languages/languageConfigurationRegistry.js';
|
||||
import { EditorSimpleWorker } from '../../../../common/services/editorSimpleWorker.js';
|
||||
import { EditorWorker } from '../../../../common/services/editorWebWorker.js';
|
||||
import { EditorWorkerService } from '../../../../browser/services/editorWorkerService.js';
|
||||
import { IModelService } from '../../../../common/services/model.js';
|
||||
import { ITextResourceConfigurationService } from '../../../../common/services/textResourceConfiguration.js';
|
||||
|
@ -62,7 +62,7 @@ suite('suggest, word distance', function () {
|
|||
|
||||
const service = new class extends EditorWorkerService {
|
||||
|
||||
private _worker = new EditorSimpleWorker();
|
||||
private _worker = new EditorWorker();
|
||||
|
||||
constructor() {
|
||||
super(null!, modelService, new class extends mock<ITextResourceConfigurationService>() { }, new NullLogService(), new TestLanguageConfigurationService(), new LanguageFeaturesService());
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { initialize } from '../base/common/worker/webWorkerBootstrap.js';
|
||||
import { EditorSimpleWorker, IWorkerContext } from './common/services/editorSimpleWorker.js';
|
||||
import { EditorWorker, IWorkerContext } from './common/services/editorWebWorker.js';
|
||||
import { EditorWorkerHost } from './common/services/editorWorkerHost.js';
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,7 @@ import { EditorWorkerHost } from './common/services/editorWorkerHost.js';
|
|||
* @internal
|
||||
*/
|
||||
export function start<THost extends object, TClient extends object>(client: TClient): IWorkerContext<THost> {
|
||||
const webWorkerServer = initialize(() => new EditorSimpleWorker(client));
|
||||
const webWorkerServer = initialize(() => new EditorWorker(client));
|
||||
const editorWorkerHost = EditorWorkerHost.getChannel(webWorkerServer);
|
||||
const host = new Proxy({}, {
|
||||
get(target, prop, receiver) {
|
||||
|
|
|
@ -8,14 +8,14 @@ import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/c
|
|||
import { Position } from '../../../common/core/position.js';
|
||||
import { IRange, Range } from '../../../common/core/range.js';
|
||||
import { TextEdit } from '../../../common/languages.js';
|
||||
import { EditorSimpleWorker } from '../../../common/services/editorSimpleWorker.js';
|
||||
import { EditorWorker } from '../../../common/services/editorWebWorker.js';
|
||||
import { ICommonModel } from '../../../common/services/textModelSync/textModelSync.impl.js';
|
||||
|
||||
suite('EditorSimpleWorker', () => {
|
||||
suite('EditorWebWorker', () => {
|
||||
|
||||
ensureNoDisposablesAreLeakedInTestSuite();
|
||||
|
||||
class WorkerWithModels extends EditorSimpleWorker {
|
||||
class WorkerWithModels extends EditorWorker {
|
||||
|
||||
getModel(uri: string) {
|
||||
return this._getModel(uri);
|
|
@ -19,7 +19,7 @@ export class WorkbenchEditorWorkerService extends EditorWorkerService {
|
|||
@ILanguageConfigurationService languageConfigurationService: ILanguageConfigurationService,
|
||||
@ILanguageFeaturesService languageFeaturesService: ILanguageFeaturesService,
|
||||
) {
|
||||
const workerDescriptor = new WorkerDescriptor('vs/editor/common/services/editorSimpleWorker', 'TextEditorWorker');
|
||||
const workerDescriptor = new WorkerDescriptor('vs/editor/common/services/editorWebWorker', 'TextEditorWorker');
|
||||
super(workerDescriptor, modelService, configurationService, logService, languageConfigurationService, languageFeaturesService);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import { IModelService } from '../../../../../editor/common/services/model.js';
|
|||
import { assertType } from '../../../../../base/common/types.js';
|
||||
import { DiffAlgorithmName, IEditorWorkerService, ILineChange } from '../../../../../editor/common/services/editorWorker.js';
|
||||
import { IDocumentDiff, IDocumentDiffProviderOptions } from '../../../../../editor/common/diff/documentDiffProvider.js';
|
||||
import { EditorSimpleWorker } from '../../../../../editor/common/services/editorSimpleWorker.js';
|
||||
import { EditorWorker } from '../../../../../editor/common/services/editorWebWorker.js';
|
||||
import { LineRange } from '../../../../../editor/common/core/lineRange.js';
|
||||
import { MovedText } from '../../../../../editor/common/diff/linesDiffComputer.js';
|
||||
import { LineRangeMapping, DetailedLineRangeMapping, RangeMapping } from '../../../../../editor/common/diff/rangeMapping.js';
|
||||
|
@ -18,7 +18,7 @@ import { TextEdit } from '../../../../../editor/common/languages.js';
|
|||
|
||||
export class TestWorkerService extends mock<IEditorWorkerService>() {
|
||||
|
||||
private readonly _worker = new EditorSimpleWorker();
|
||||
private readonly _worker = new EditorWorker();
|
||||
|
||||
constructor(@IModelService private readonly _modelService: IModelService) {
|
||||
super();
|
||||
|
|
|
@ -278,8 +278,6 @@ class NotebookWorkerClient extends Disposable {
|
|||
'NotebookEditorWorker'
|
||||
));
|
||||
} catch (err) {
|
||||
// logOnceWebWorkerWarning(err);
|
||||
// this._worker = new SynchronousWorkerClient(new EditorSimpleWorker(new EditorWorkerHost(this), null));
|
||||
throw (err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as monaco from 'monaco-editor-core';
|
|||
|
||||
self.MonacoEnvironment = {
|
||||
getWorkerUrl: function (moduleId, label) {
|
||||
return './editorSimpleWorkerMain.bundle.js';
|
||||
return './editorWebWorkerMain.bundle.js';
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
mode: 'production',
|
||||
entry: {
|
||||
'core': './core.js',
|
||||
'editorSimpleWorkerMain': '../../out-monaco-editor-core/esm/vs/editor/common/services/editorSimpleWorkerMain.js',
|
||||
'editorWebWorkerMain': '../../out-monaco-editor-core/esm/vs/editor/common/services/editorWebWorkerMain.js',
|
||||
},
|
||||
output: {
|
||||
globalObject: 'self',
|
||||
|
|
Loading…
Reference in New Issue