Skip to content

Commit

Permalink
Further clarification in TextEditorOptions #2797
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Feb 19, 2016
1 parent 9dea2c3 commit 2a15ad9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
10 changes: 7 additions & 3 deletions src/vs/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/api/node/extHostEditors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -697,7 +697,7 @@ export class MainThreadEditors {
this._textEditorsMap[id].revealRange(range, revealType);
}

_trySetOptions(id: string, options: IInternalIndentationOptions): TPromise<any> {
_trySetOptions(id: string, options: ITextEditorConfigurationUpdate): TPromise<any> {
if (!this._textEditorsMap[id]) {
return TPromise.wrapError('TextEditor disposed');
}
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/node/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export class Disposable {
}

export interface EditorOptions {
tabSize: number;
insertSpaces: boolean;
tabSize: number | string;
insertSpaces: boolean | string;
}

export class Position {
Expand Down
8 changes: 4 additions & 4 deletions src/vs/workbench/api/node/mainThreadEditors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2a15ad9

Please sign in to comment.