Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1 (#8722)

* Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1

* remove tests that aren't working
This commit is contained in:
Anthony Dresser
2019-12-18 00:14:28 -08:00
committed by GitHub
parent 0fd870d156
commit 30d9e9c141
289 changed files with 5537 additions and 3039 deletions

View File

@@ -432,8 +432,7 @@ export const editorConfigurationBaseNode = Object.freeze<IConfigurationNode>({
order: 5,
type: 'object',
title: nls.localize('editorConfigurationTitle', "Editor"),
overridable: true,
scope: ConfigurationScope.RESOURCE,
scope: ConfigurationScope.RESOURCE_LANGUAGE,
});
const configurationRegistry = Registry.as<IConfigurationRegistry>(Extensions.Configuration);

View File

@@ -1118,6 +1118,9 @@ class EditorClassName extends ComputedEditorOption<EditorOption.editorClassName,
} else if (options.get(EditorOption.mouseStyle) === 'copy') {
className += ' mouse-copy';
}
if (options.get(EditorOption.showUnused)) {
className += ' showUnused';
}
return className;
}
}

View File

@@ -436,7 +436,7 @@ export interface CompletionItem {
preselect?: boolean;
/**
* A string or snippet that should be inserted in a document when selecting
* this completion.
* this completion. When `falsy` the [label](#CompletionItem.label)
* is used.
*/
insertText: string;

View File

@@ -17,7 +17,7 @@ import { LanguageConfigurationRegistry } from 'vs/editor/common/modes/languageCo
import { EditorSimpleWorker } from 'vs/editor/common/services/editorSimpleWorker';
import { IDiffComputationResult, IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration';
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
import { regExpFlags } from 'vs/base/common/strings';
import { isNonEmptyArray } from 'vs/base/common/arrays';
import { ILogService } from 'vs/platform/log/common/log';
@@ -52,7 +52,7 @@ export class EditorWorkerServiceImpl extends Disposable implements IEditorWorker
private readonly _logService: ILogService;
constructor(
@IModelService modelService: IModelService,
@IResourceConfigurationService configurationService: IResourceConfigurationService,
@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,
@ILogService logService: ILogService
) {
super();
@@ -129,14 +129,14 @@ export class EditorWorkerServiceImpl extends Disposable implements IEditorWorker
class WordBasedCompletionItemProvider implements modes.CompletionItemProvider {
private readonly _workerManager: WorkerManager;
private readonly _configurationService: IResourceConfigurationService;
private readonly _configurationService: ITextResourceConfigurationService;
private readonly _modelService: IModelService;
readonly _debugDisplayName = 'wordbasedCompletions';
constructor(
workerManager: WorkerManager,
configurationService: IResourceConfigurationService,
configurationService: ITextResourceConfigurationService,
modelService: IModelService
) {
this._workerManager = workerManager;
@@ -236,7 +236,7 @@ class WorkerManager extends Disposable {
public withWorker(): Promise<EditorWorkerClient> {
this._lastWorkerUsedTime = (new Date()).getTime();
if (!this._editorWorkerClient) {
this._editorWorkerClient = new EditorWorkerClient(this._modelService, 'editorWorkerService');
this._editorWorkerClient = new EditorWorkerClient(this._modelService, false, 'editorWorkerService');
}
return Promise.resolve(this._editorWorkerClient);
}
@@ -374,13 +374,15 @@ export class EditorWorkerHost {
export class EditorWorkerClient extends Disposable {
private readonly _modelService: IModelService;
private readonly _keepIdleModels: boolean;
private _worker: IWorkerClient<EditorSimpleWorker> | null;
private readonly _workerFactory: DefaultWorkerFactory;
private _modelManager: EditorModelManager | null;
constructor(modelService: IModelService, label: string | undefined) {
constructor(modelService: IModelService, keepIdleModels: boolean, label: string | undefined) {
super();
this._modelService = modelService;
this._keepIdleModels = keepIdleModels;
this._workerFactory = new DefaultWorkerFactory(label);
this._worker = null;
this._modelManager = null;
@@ -417,7 +419,7 @@ export class EditorWorkerClient extends Disposable {
private _getOrCreateModelManager(proxy: EditorSimpleWorker): EditorModelManager {
if (!this._modelManager) {
this._modelManager = this._register(new EditorModelManager(proxy, this._modelService, false));
this._modelManager = this._register(new EditorModelManager(proxy, this._modelService, this._keepIdleModels));
}
return this._modelManager;
}

View File

@@ -18,7 +18,7 @@ import { LanguageIdentifier, SemanticTokensProviderRegistry, SemanticTokensProvi
import { PLAINTEXT_LANGUAGE_IDENTIFIER } from 'vs/editor/common/modes/modesRegistry';
import { ILanguageSelection } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { RunOnceScheduler } from 'vs/base/common/async';
import { CancellationTokenSource } from 'vs/base/common/cancellation';

View File

@@ -9,9 +9,9 @@ import { IPosition } from 'vs/editor/common/core/position';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
export const IResourceConfigurationService = createDecorator<IResourceConfigurationService>('resourceConfigurationService');
export const ITextResourceConfigurationService = createDecorator<ITextResourceConfigurationService>('textResourceConfigurationService');
export interface IResourceConfigurationChangeEvent {
export interface ITextResourceConfigurationChangeEvent {
/**
* All affected keys. Also includes language overrides and keys changed under language overrides.
@@ -29,14 +29,14 @@ export interface IResourceConfigurationChangeEvent {
affectsConfiguration(resource: URI, section: string): boolean;
}
export interface IResourceConfigurationService {
export interface ITextResourceConfigurationService {
_serviceBrand: undefined;
/**
* Event that fires when the configuration changes.
*/
onDidChangeConfiguration: Event<IResourceConfigurationChangeEvent>;
onDidChangeConfiguration: Event<ITextResourceConfigurationChangeEvent>;
/**
* Fetches the value of the section for the given resource by applying language overrides.

View File

@@ -9,15 +9,15 @@ import { URI } from 'vs/base/common/uri';
import { IPosition, Position } from 'vs/editor/common/core/position';
import { IModeService } from 'vs/editor/common/services/modeService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IResourceConfigurationService, IResourceConfigurationChangeEvent } from 'vs/editor/common/services/resourceConfiguration';
import { ITextResourceConfigurationService, ITextResourceConfigurationChangeEvent } from 'vs/editor/common/services/textResourceConfigurationService';
import { IConfigurationService, ConfigurationTarget, IConfigurationValue, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
export class TextResourceConfigurationService extends Disposable implements IResourceConfigurationService {
export class TextResourceConfigurationService extends Disposable implements ITextResourceConfigurationService {
public _serviceBrand: undefined;
private readonly _onDidChangeConfiguration: Emitter<IResourceConfigurationChangeEvent> = this._register(new Emitter<IResourceConfigurationChangeEvent>());
public readonly onDidChangeConfiguration: Event<IResourceConfigurationChangeEvent> = this._onDidChangeConfiguration.event;
private readonly _onDidChangeConfiguration: Emitter<ITextResourceConfigurationChangeEvent> = this._register(new Emitter<ITextResourceConfigurationChangeEvent>());
public readonly onDidChangeConfiguration: Event<ITextResourceConfigurationChangeEvent> = this._onDidChangeConfiguration.event;
constructor(
@IConfigurationService private readonly configurationService: IConfigurationService,
@@ -45,15 +45,15 @@ export class TextResourceConfigurationService extends Disposable implements IRes
}
switch (configurationTarget) {
case ConfigurationTarget.MEMORY:
return this._updateValue(key, value, configurationTarget, configurationValue.memoryTarget?.override, resource, language);
return this._updateValue(key, value, configurationTarget, configurationValue.memory?.override, resource, language);
case ConfigurationTarget.WORKSPACE_FOLDER:
return this._updateValue(key, value, configurationTarget, configurationValue.workspaceFolderTarget?.override, resource, language);
return this._updateValue(key, value, configurationTarget, configurationValue.workspaceFolder?.override, resource, language);
case ConfigurationTarget.WORKSPACE:
return this._updateValue(key, value, configurationTarget, configurationValue.workspaceTarget?.override, resource, language);
return this._updateValue(key, value, configurationTarget, configurationValue.workspace?.override, resource, language);
case ConfigurationTarget.USER_REMOTE:
return this._updateValue(key, value, configurationTarget, configurationValue.userRemoteTarget?.override, resource, language);
return this._updateValue(key, value, configurationTarget, configurationValue.userRemote?.override, resource, language);
default:
return this._updateValue(key, value, configurationTarget, configurationValue.userLocalTarget?.override, resource, language);
return this._updateValue(key, value, configurationTarget, configurationValue.userLocal?.override, resource, language);
}
}
@@ -67,32 +67,32 @@ export class TextResourceConfigurationService extends Disposable implements IRes
private deriveConfigurationTarget(configurationValue: IConfigurationValue<any>, language: string | null): ConfigurationTarget {
if (language) {
if (configurationValue.memoryTarget?.override !== undefined) {
if (configurationValue.memory?.override !== undefined) {
return ConfigurationTarget.MEMORY;
}
if (configurationValue.workspaceFolderTarget?.override !== undefined) {
if (configurationValue.workspaceFolder?.override !== undefined) {
return ConfigurationTarget.WORKSPACE_FOLDER;
}
if (configurationValue.workspaceTarget?.override !== undefined) {
if (configurationValue.workspace?.override !== undefined) {
return ConfigurationTarget.WORKSPACE;
}
if (configurationValue.userRemoteTarget?.override !== undefined) {
if (configurationValue.userRemote?.override !== undefined) {
return ConfigurationTarget.USER_REMOTE;
}
if (configurationValue.userLocalTarget?.override !== undefined) {
if (configurationValue.userLocal?.override !== undefined) {
return ConfigurationTarget.USER_LOCAL;
}
}
if (configurationValue.memoryTarget?.value !== undefined) {
if (configurationValue.memory?.value !== undefined) {
return ConfigurationTarget.MEMORY;
}
if (configurationValue.workspaceFolderTarget?.value !== undefined) {
if (configurationValue.workspaceFolder?.value !== undefined) {
return ConfigurationTarget.WORKSPACE_FOLDER;
}
if (configurationValue.workspaceTarget?.value !== undefined) {
if (configurationValue.workspace?.value !== undefined) {
return ConfigurationTarget.WORKSPACE;
}
if (configurationValue.userRemoteTarget?.value !== undefined) {
if (configurationValue.userRemote?.value !== undefined) {
return ConfigurationTarget.USER_REMOTE;
}
return ConfigurationTarget.USER_LOCAL;
@@ -114,7 +114,7 @@ export class TextResourceConfigurationService extends Disposable implements IRes
return this.modeService.getModeIdByFilepathOrFirstLine(resource);
}
private toResourceConfigurationChangeEvent(configurationChangeEvent: IConfigurationChangeEvent): IResourceConfigurationChangeEvent {
private toResourceConfigurationChangeEvent(configurationChangeEvent: IConfigurationChangeEvent): ITextResourceConfigurationChangeEvent {
return {
affectedKeys: configurationChangeEvent.affectedKeys,
affectsConfiguration: (resource: URI, configuration: string) => {

View File

@@ -53,6 +53,11 @@ export interface IWebWorkerOptions {
* An object that can be used by the web worker to make calls back to the main thread.
*/
host?: any;
/**
* Keep idle models.
* Defaults to false, which means that idle models will stop syncing after a while.
*/
keepIdleModels?: boolean;
}
class MonacoWebWorkerImpl<T> extends EditorWorkerClient implements MonacoWebWorker<T> {
@@ -63,7 +68,7 @@ class MonacoWebWorkerImpl<T> extends EditorWorkerClient implements MonacoWebWork
private _foreignProxy: Promise<T> | null;
constructor(modelService: IModelService, opts: IWebWorkerOptions) {
super(modelService, opts.label);
super(modelService, opts.keepIdleModels || false, opts.label);
this._foreignModuleId = opts.moduleId;
this._foreignModuleCreateData = opts.createData || null;
this._foreignModuleHost = opts.host || null;