diff --git a/src/vs/editor/contrib/indentation/common/indentation.ts b/src/vs/editor/contrib/indentation/common/indentation.ts index ddc2f42bc2ab77898d715d0493ed6ed58ddef9c8..cf1d8efe6c9276ef74d19f072322a4daf726a764 100644 --- a/src/vs/editor/contrib/indentation/common/indentation.ts +++ b/src/vs/editor/contrib/indentation/common/indentation.ts @@ -50,9 +50,11 @@ export class IndentationToTabsAction extends EditorAction { } } -export abstract class Indent extends EditorAction { +export class ChangeIndentationSizeAction extends EditorAction { - constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor, private insertSpaces: boolean, private quickOpenService: IQuickOpenService) { + static ID = 'editor.action.changeIndentationSize'; + + constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor, @IQuickOpenService private quickOpenService: IQuickOpenService) { super(descriptor, editor); } @@ -60,7 +62,6 @@ export abstract class Indent extends EditorAction { return TPromise.timeout(50 /* quick open is sensitive to being opened so soon after another */).then(() => this.quickOpenService.pick(['1', '2', '3', '4', '5', '6', '7', '8'], { placeHolder: nls.localize('selectTabWidth', "Select Tab Width")}).then(pick => { this.editor.updateOptions({ - insertSpaces: this.insertSpaces, tabSize: parseInt(pick) }); return true; @@ -69,24 +70,7 @@ export abstract class Indent extends EditorAction { } } -export class IndentUsingSpaces extends Indent { - static ID = 'editor.action.indentUsingSpaces'; - - constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor, @IQuickOpenService quickOpenService: IQuickOpenService) { - super(descriptor, editor, true, quickOpenService); - } -} - -export class IndentUsingTabs extends Indent { - static ID = 'editor.action.indentUsingTabs'; - - constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor, @IQuickOpenService quickOpenService: IQuickOpenService) { - super(descriptor, editor, false, quickOpenService); - } -} - // register actions CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(IndentationToSpacesAction, IndentationToSpacesAction.ID, nls.localize('indentationToSpaces', "Convert Indentation to Spaces"))); CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(IndentationToTabsAction, IndentationToTabsAction.ID, nls.localize('indentationToTabs', "Convert Indentation to Tabs"))); -CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(IndentUsingSpaces, IndentUsingSpaces.ID, nls.localize('indentUsingSpaces', "Indent Using Spaces"))); -CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(IndentUsingTabs, IndentUsingTabs.ID, nls.localize('indentUsingTabs', "Indent Using Tabs"))); +CommonEditorRegistry.registerEditorAction(new EditorActionDescriptor(ChangeIndentationSizeAction, ChangeIndentationSizeAction.ID, nls.localize('changeIndentationSize', "Change Indentation Size"))); diff --git a/src/vs/workbench/browser/parts/editor/editorStatus.ts b/src/vs/workbench/browser/parts/editor/editorStatus.ts index b42f3831d534e0d29fec49403b4ef1ad8b99db18..2d129649fe6020b365c68ef5ad881d3382b8cf72 100644 --- a/src/vs/workbench/browser/parts/editor/editorStatus.ts +++ b/src/vs/workbench/browser/parts/editor/editorStatus.ts @@ -22,7 +22,7 @@ import {IDisposable, combinedDispose} from 'vs/base/common/lifecycle'; import {ICommonCodeEditor} from 'vs/editor/common/editorCommon'; import {ICodeEditor, IDiffEditor} from 'vs/editor/browser/editorBrowser'; import {EndOfLineSequence, ITokenizedModel, EditorType, IEditorSelection, ITextModel, IDiffEditorModel, IEditor} from 'vs/editor/common/editorCommon'; -import {IndentUsingSpaces, IndentUsingTabs, IndentationToSpacesAction, IndentationToTabsAction} from 'vs/editor/contrib/indentation/common/indentation'; +import {ChangeIndentationSizeAction, IndentationToSpacesAction, IndentationToTabsAction} from 'vs/editor/contrib/indentation/common/indentation'; import {EventType, ResourceEvent, EditorEvent, TextEditorSelectionEvent} from 'vs/workbench/common/events'; import {BaseTextEditor} from 'vs/workbench/browser/parts/editor/textEditor'; import {IEditor as IBaseEditor} from 'vs/platform/editor/common/editor'; @@ -685,7 +685,7 @@ export class ChangeIndentationAction extends Action { } const control = activeEditor.getControl(); - return this.quickOpenService.pick([control.getAction(IndentUsingSpaces.ID), control.getAction(IndentUsingTabs.ID), control.getAction(IndentationToSpacesAction.ID), control.getAction(IndentationToTabsAction.ID)], { + return this.quickOpenService.pick([control.getAction(ChangeIndentationSizeAction.ID), control.getAction(IndentationToSpacesAction.ID), control.getAction(IndentationToTabsAction.ID)], { placeHolder: nls.localize('pickAction', "Select Action") }).then(action => action && action.run()); }