Merge from vscode 3a6dcb42008d509900b3a3b2d695564eeb4dbdac (#5098)

This commit is contained in:
Alan Ren
2019-04-17 23:38:44 -07:00
committed by GitHub
parent 1fec26c6b3
commit b852f032d3
63 changed files with 676 additions and 413 deletions

View File

@@ -55,7 +55,7 @@ export class OpenerService implements IOpenerService {
if (equalsIgnoreCase(scheme, Schemas.http) || equalsIgnoreCase(scheme, Schemas.https) || equalsIgnoreCase(scheme, Schemas.mailto)) {
// open http or default mail application
dom.windowOpenNoOpener(resource.toString(true));
dom.windowOpenNoOpener(encodeURI(resource.toString(true)));
return Promise.resolve(true);
} else if (equalsIgnoreCase(scheme, Schemas.command)) {

View File

@@ -1288,6 +1288,7 @@ export interface CommentThread2 {
onDidChangeRange: Event<IRange>;
onDidChangeLabel: Event<string>;
onDidChangeCollasibleState: Event<CommentThreadCollapsibleState | undefined>;
isDisposed: boolean;
}
/**
@@ -1312,6 +1313,7 @@ export interface CommentThread {
comments: Comment[] | undefined;
collapsibleState?: CommentThreadCollapsibleState;
reply?: Command;
isDisposed?: boolean;
}
/**

View File

@@ -399,7 +399,7 @@ export abstract class BaseEditorSimpleWorker {
// ---- BEGIN minimal edits ---------------------------------------------------------------
private static readonly _diffLimit = 10000;
private static readonly _diffLimit = 100000;
public computeMoreMinimalEdits(modelUrl: string, edits: TextEdit[]): Promise<TextEdit[]> {
const model = this._getModel(modelUrl);
@@ -432,7 +432,7 @@ export abstract class BaseEditorSimpleWorker {
}
const original = model.getValueInRange(range);
text = text!.replace(/\r\n|\n|\r/g, model.eol);
text = text.replace(/\r\n|\n|\r/g, model.eol);
if (original === text) {
// noop

View File

@@ -21,6 +21,8 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { regExpFlags } from 'vs/base/common/strings';
import { isNonEmptyArray } from 'vs/base/common/arrays';
import { ILogService } from 'vs/platform/log/common/log';
import { StopWatch } from 'vs/base/common/stopwatch';
/**
* Stop syncing a model to the worker if it was not needed for 1 min.
@@ -48,14 +50,16 @@ export class EditorWorkerServiceImpl extends Disposable implements IEditorWorker
private readonly _modelService: IModelService;
private readonly _workerManager: WorkerManager;
private readonly _logService: ILogService;
constructor(
@IModelService modelService: IModelService,
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@ILogService logService: ILogService
) {
super();
this._modelService = modelService;
this._workerManager = this._register(new WorkerManager(this._modelService));
this._logService = logService;
// todo@joh make sure this happens only once
this._register(modes.LinkProviderRegistry.register('*', {
@@ -96,7 +100,10 @@ export class EditorWorkerServiceImpl extends Disposable implements IEditorWorker
if (!canSyncModel(this._modelService, resource)) {
return Promise.resolve(edits); // File too large
}
return this._workerManager.withWorker().then(client => client.computeMoreMinimalEdits(resource, edits));
const sw = StopWatch.create(true);
const result = this._workerManager.withWorker().then(client => client.computeMoreMinimalEdits(resource, edits));
result.finally(() => this._logService.trace('FORMAT#computeMoreMinimalEdits', resource.toString(true), sw.elapsed()));
return result;
} else {
return Promise.resolve(undefined);

View File

@@ -145,8 +145,6 @@ export module StaticServices {
export const markerDecorationsService = define(IMarkerDecorationsService, (o) => new MarkerDecorationsService(modelService.get(o), markerService.get(o)));
export const editorWorkerService = define(IEditorWorkerService, (o) => new EditorWorkerServiceImpl(modelService.get(o), resourceConfigurationService.get(o)));
export const standaloneThemeService = define(IStandaloneThemeService, () => new StandaloneThemeServiceImpl());
export const codeEditorService = define(ICodeEditorService, (o) => new StandaloneCodeEditorServiceImpl(standaloneThemeService.get(o)));
@@ -157,6 +155,8 @@ export module StaticServices {
export const logService = define(ILogService, () => new NullLogService());
export const editorWorkerService = define(IEditorWorkerService, (o) => new EditorWorkerServiceImpl(modelService.get(o), resourceConfigurationService.get(o), logService.get(o)));
export const suggestMemoryService = define(ISuggestMemoryService, (o) => new SuggestMemoryService(storageService.get(o), configurationService.get(o)));
}