mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-24 02:28:34 +01:00
Merge remote-tracking branch 'upstream/master' into user/gabrield/extensionCallbackAsTask
This commit is contained in:
@@ -127,8 +127,8 @@ export interface MainThreadCommentsShape extends IDisposable {
|
||||
}
|
||||
|
||||
export interface MainThreadConfigurationShape extends IDisposable {
|
||||
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any, resource: UriComponents): Promise<void>;
|
||||
$removeConfigurationOption(target: ConfigurationTarget, key: string, resource: UriComponents): Promise<void>;
|
||||
$updateConfigurationOption(target: ConfigurationTarget | null, key: string, value: any, resource: UriComponents | undefined): Promise<void>;
|
||||
$removeConfigurationOption(target: ConfigurationTarget | null, key: string, resource: UriComponents | undefined): Promise<void>;
|
||||
}
|
||||
|
||||
export interface MainThreadDiagnosticsShape extends IDisposable {
|
||||
@@ -176,6 +176,7 @@ export interface MainThreadDocumentsShape extends IDisposable {
|
||||
|
||||
export interface ITextEditorConfigurationUpdate {
|
||||
tabSize?: number | 'auto';
|
||||
indentSize?: number | 'tabSize';
|
||||
insertSpaces?: boolean | 'auto';
|
||||
cursorStyle?: TextEditorCursorStyle;
|
||||
lineNumbers?: TextEditorLineNumbersStyle;
|
||||
@@ -183,6 +184,7 @@ export interface ITextEditorConfigurationUpdate {
|
||||
|
||||
export interface IResolvedTextEditorConfiguration {
|
||||
tabSize: number;
|
||||
indentSize: number;
|
||||
insertSpaces: boolean;
|
||||
cursorStyle: TextEditorCursorStyle;
|
||||
lineNumbers: TextEditorLineNumbersStyle;
|
||||
|
||||
@@ -64,7 +64,7 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape {
|
||||
}
|
||||
|
||||
$acceptConfigurationChanged(data: IConfigurationInitData, eventData: IWorkspaceConfigurationChangeEventData): void {
|
||||
this._actual.$acceptConfigurationChanged(data, eventData);
|
||||
this.getConfigProvider().then(provider => provider.$acceptConfigurationChanged(data, eventData));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ export class ExtHostConfigProvider {
|
||||
} else {
|
||||
let clonedConfig = undefined;
|
||||
const cloneOnWriteProxy = (target: any, accessor: string): any => {
|
||||
let clonedTarget = undefined;
|
||||
let clonedTarget: any | undefined = undefined;
|
||||
const cloneTarget = () => {
|
||||
clonedConfig = clonedConfig ? clonedConfig : deepClone(config);
|
||||
clonedTarget = clonedTarget ? clonedTarget : lookUp(clonedConfig, accessor);
|
||||
@@ -153,17 +153,23 @@ export class ExtHostConfigProvider {
|
||||
},
|
||||
set: (_target: any, property: string, value: any) => {
|
||||
cloneTarget();
|
||||
clonedTarget[property] = value;
|
||||
if (clonedTarget) {
|
||||
clonedTarget[property] = value;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
deleteProperty: (_target: any, property: string) => {
|
||||
cloneTarget();
|
||||
delete clonedTarget[property];
|
||||
if (clonedTarget) {
|
||||
delete clonedTarget[property];
|
||||
}
|
||||
return true;
|
||||
},
|
||||
defineProperty: (_target: any, property: string, descriptor: any) => {
|
||||
cloneTarget();
|
||||
Object.defineProperty(clonedTarget, property, descriptor);
|
||||
if (clonedTarget) {
|
||||
Object.defineProperty(clonedTarget, property, descriptor);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}) : target;
|
||||
@@ -181,7 +187,7 @@ export class ExtHostConfigProvider {
|
||||
return this._proxy.$removeConfigurationOption(target, key, resource);
|
||||
}
|
||||
},
|
||||
inspect: <T>(key: string): ConfigurationInspect<T> => {
|
||||
inspect: <T>(key: string): ConfigurationInspect<T> | undefined => {
|
||||
key = section ? `${section}.${key}` : key;
|
||||
const config = deepClone(this._configuration.inspect<T>(key, { resource }, this._extHostWorkspace.workspace));
|
||||
if (config) {
|
||||
@@ -220,7 +226,7 @@ export class ExtHostConfigProvider {
|
||||
return readonlyProxy(result);
|
||||
}
|
||||
|
||||
private _validateConfigurationAccess(key: string, resource: URI | undefined, extensionId: ExtensionIdentifier): void {
|
||||
private _validateConfigurationAccess(key: string, resource: URI | undefined, extensionId?: ExtensionIdentifier): void {
|
||||
const scope = OVERRIDE_PROPERTY_PATTERN.test(key) ? ConfigurationScope.RESOURCE : this._configurationScopes[key];
|
||||
const extensionIdText = extensionId ? `[${extensionId.value}] ` : '';
|
||||
if (ConfigurationScope.RESOURCE === scope) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { join } from 'vs/base/common/extpath';
|
||||
import { join } from 'vs/base/common/path';
|
||||
import { ILogService, DelegatedLogService, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { createSpdLogService } from 'vs/platform/log/node/spdlogService';
|
||||
import { ExtHostLogServiceShape } from 'vs/workbench/api/node/extHost.protocol';
|
||||
@@ -11,7 +11,6 @@ import { ExtensionHostLogFileName } from 'vs/workbench/services/extensions/commo
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
|
||||
export class ExtHostLogService extends DelegatedLogService implements ILogService, ExtHostLogServiceShape {
|
||||
|
||||
private _logsPath: string;
|
||||
|
||||
@@ -142,6 +142,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions {
|
||||
private _id: string;
|
||||
|
||||
private _tabSize: number;
|
||||
private _indentSize: number;
|
||||
private _insertSpaces: boolean;
|
||||
private _cursorStyle: TextEditorCursorStyle;
|
||||
private _lineNumbers: TextEditorLineNumbersStyle;
|
||||
@@ -154,6 +155,7 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions {
|
||||
|
||||
public _accept(source: IResolvedTextEditorConfiguration): void {
|
||||
this._tabSize = source.tabSize;
|
||||
this._indentSize = source.indentSize;
|
||||
this._insertSpaces = source.insertSpaces;
|
||||
this._cursorStyle = source.cursorStyle;
|
||||
this._lineNumbers = source.lineNumbers;
|
||||
@@ -200,6 +202,47 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions {
|
||||
}));
|
||||
}
|
||||
|
||||
public get indentSize(): number | string {
|
||||
return this._indentSize;
|
||||
}
|
||||
|
||||
private _validateIndentSize(value: number | string): number | 'tabSize' | null {
|
||||
if (value === 'tabSize') {
|
||||
return 'tabSize';
|
||||
}
|
||||
if (typeof value === 'number') {
|
||||
let r = Math.floor(value);
|
||||
return (r > 0 ? r : null);
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
let r = parseInt(value, 10);
|
||||
if (isNaN(r)) {
|
||||
return null;
|
||||
}
|
||||
return (r > 0 ? r : null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public set indentSize(value: number | string) {
|
||||
let indentSize = this._validateIndentSize(value);
|
||||
if (indentSize === null) {
|
||||
// ignore invalid call
|
||||
return;
|
||||
}
|
||||
if (typeof indentSize === 'number') {
|
||||
if (this._indentSize === indentSize) {
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
// reflect the new indentSize value immediately
|
||||
this._indentSize = indentSize;
|
||||
}
|
||||
warnOnError(this._proxy.$trySetOptions(this._id, {
|
||||
indentSize: indentSize
|
||||
}));
|
||||
}
|
||||
|
||||
public get insertSpaces(): boolean | string {
|
||||
return this._insertSpaces;
|
||||
}
|
||||
@@ -273,6 +316,19 @@ export class ExtHostTextEditorOptions implements vscode.TextEditorOptions {
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof newOptions.indentSize !== 'undefined') {
|
||||
let indentSize = this._validateIndentSize(newOptions.indentSize);
|
||||
if (indentSize === 'tabSize') {
|
||||
hasUpdate = true;
|
||||
bulkConfigurationUpdate.indentSize = indentSize;
|
||||
} else if (typeof indentSize === 'number' && this._indentSize !== indentSize) {
|
||||
// reflect the new indentSize value immediately
|
||||
this._indentSize = indentSize;
|
||||
hasUpdate = true;
|
||||
bulkConfigurationUpdate.indentSize = indentSize;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof newOptions.insertSpaces !== 'undefined') {
|
||||
let insertSpaces = this._validateInsertSpaces(newOptions.insertSpaces);
|
||||
if (insertSpaces === 'auto') {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as crypto from 'crypto';
|
||||
import { relative } from 'vs/base/common/path';
|
||||
import { coalesce, equals } from 'vs/base/common/arrays';
|
||||
import { illegalArgument } from 'vs/base/common/errors';
|
||||
import { IRelativePattern } from 'vs/base/common/glob';
|
||||
@@ -2066,10 +2065,6 @@ export class RelativePattern implements IRelativePattern {
|
||||
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public pathToRelative(from: string, to: string): string {
|
||||
return relative(from, to);
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
|
||||
@@ -56,7 +56,7 @@ interface MutableWorkspaceFolder extends vscode.WorkspaceFolder {
|
||||
|
||||
class ExtHostWorkspaceImpl extends Workspace {
|
||||
|
||||
static toExtHostWorkspace(data: IWorkspaceData, previousConfirmedWorkspace?: ExtHostWorkspaceImpl, previousUnconfirmedWorkspace?: ExtHostWorkspaceImpl): { workspace: ExtHostWorkspaceImpl | null, added: vscode.WorkspaceFolder[], removed: vscode.WorkspaceFolder[] } {
|
||||
static toExtHostWorkspace(data: IWorkspaceData | null, previousConfirmedWorkspace?: ExtHostWorkspaceImpl, previousUnconfirmedWorkspace?: ExtHostWorkspaceImpl): { workspace: ExtHostWorkspaceImpl | null, added: vscode.WorkspaceFolder[], removed: vscode.WorkspaceFolder[] } {
|
||||
if (!data) {
|
||||
return { workspace: null, added: [], removed: [] };
|
||||
}
|
||||
@@ -198,7 +198,7 @@ export class ExtHostWorkspaceProvider {
|
||||
|
||||
constructor(
|
||||
mainContext: IMainContext,
|
||||
data: IWorkspaceData,
|
||||
data: IWorkspaceData | null,
|
||||
private _logService: ILogService,
|
||||
private _requestIdProvider: Counter
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user