From 2a15ad9dfb1a58f7b71f43c51c1ca58a4eff1987 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 19 Feb 2016 17:34:53 +0100 Subject: [PATCH] Further clarification in TextEditorOptions #2797 --- src/vs/vscode.d.ts | 10 +++++++--- src/vs/workbench/api/node/extHostEditors.ts | 6 +++--- src/vs/workbench/api/node/extHostTypes.ts | 4 ++-- src/vs/workbench/api/node/mainThreadEditors.ts | 8 ++++---- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index e437b85e713bf..1fb83005189d9 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -532,13 +532,17 @@ declare namespace vscode { * The size in spaces a tab takes. This is used for two purposes: * - the rendering width of a tab character; * - the number of spaces to insert when [insertSpaces](#TextEditorOptions.insertSpaces) is true. + * When getting a text editor's options, this property will always be a number (resolved). + * When setting a text editor's options, this property is optional and it can be a number or `"auto"`. */ - tabSize: number | string; + tabSize?: number | string; /** * When pressing Tab insert [n](#TextEditorOptions.tabSize) spaces. + * When getting a text editor's options, this property will always be a boolean (resolved). + * When setting a text editor's options, this property is optional and it can be a boolean or `"auto"`. */ - insertSpaces: boolean | string; + insertSpaces?: boolean | string; } /** @@ -3104,7 +3108,7 @@ declare namespace vscode { /** * The folder that is open in VS Code. `undefined` when no folder * has been opened. - * + * * @readonly */ export let rootPath: string; diff --git a/src/vs/workbench/api/node/extHostEditors.ts b/src/vs/workbench/api/node/extHostEditors.ts index a56205bd4f581..14c89c8daf49c 100644 --- a/src/vs/workbench/api/node/extHostEditors.ts +++ b/src/vs/workbench/api/node/extHostEditors.ts @@ -11,12 +11,12 @@ import {TPromise} from 'vs/base/common/winjs.base'; import {Remotable, IThreadService} from 'vs/platform/thread/common/thread'; import {ExtHostModelService, ExtHostDocumentData} from 'vs/workbench/api/node/extHostDocuments'; import {Selection, Range, Position, EditorOptions} from './extHostTypes'; -import {ISingleEditOperation, ISelection, IRange, IInternalIndentationOptions, IEditor, EditorType, ICommonCodeEditor, ICommonDiffEditor, IDecorationRenderOptions, IRangeWithMessage} from 'vs/editor/common/editorCommon'; +import {ISingleEditOperation, ISelection, IRange, IEditor, EditorType, ICommonCodeEditor, ICommonDiffEditor, IDecorationRenderOptions, IRangeWithMessage} from 'vs/editor/common/editorCommon'; import {ICodeEditorService} from 'vs/editor/common/services/codeEditorService'; import {IWorkbenchEditorService} from 'vs/workbench/services/editor/common/editorService'; import {Position as EditorPosition} from 'vs/platform/editor/common/editor'; import {IModelService} from 'vs/editor/common/services/modelService'; -import {MainThreadEditorsTracker, TextEditorRevealType, MainThreadTextEditor, ITextEditorConfiguration} from 'vs/workbench/api/node/mainThreadEditors'; +import {MainThreadEditorsTracker, TextEditorRevealType, MainThreadTextEditor, ITextEditorConfigurationUpdate, ITextEditorConfiguration} from 'vs/workbench/api/node/mainThreadEditors'; import * as TypeConverters from './extHostTypeConverters'; import {TextDocument, TextEditorSelectionChangeEvent, TextEditorOptionsChangeEvent, TextEditorOptions, TextEditorViewColumnChangeEvent, ViewColumn} from 'vscode'; import {EventType} from 'vs/workbench/common/events'; @@ -697,7 +697,7 @@ export class MainThreadEditors { this._textEditorsMap[id].revealRange(range, revealType); } - _trySetOptions(id: string, options: IInternalIndentationOptions): TPromise { + _trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise { if (!this._textEditorsMap[id]) { return TPromise.wrapError('TextEditor disposed'); } diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index ab295e73a0c40..0905bb768d44b 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -37,8 +37,8 @@ export class Disposable { } export interface EditorOptions { - tabSize: number; - insertSpaces: boolean; + tabSize: number | string; + insertSpaces: boolean | string; } export class Position { diff --git a/src/vs/workbench/api/node/mainThreadEditors.ts b/src/vs/workbench/api/node/mainThreadEditors.ts index eb0e7ed6e0f3a..78babf2739497 100644 --- a/src/vs/workbench/api/node/mainThreadEditors.ts +++ b/src/vs/workbench/api/node/mainThreadEditors.ts @@ -15,12 +15,12 @@ import {Range} from 'vs/editor/common/core/range'; import {Selection} from 'vs/editor/common/core/selection'; export interface ITextEditorConfigurationUpdate { - tabSize?: number; - insertSpaces?: boolean; + tabSize?: number | string; + insertSpaces?: boolean | string; } export interface ITextEditorConfiguration { - tabSize: number; - insertSpaces: boolean; + tabSize: number | string; + insertSpaces: boolean | string; } function configurationsEqual(a:ITextEditorConfiguration, b:ITextEditorConfiguration) {