diff --git a/src/vs/editor/contrib/format/common/formatActions.ts b/src/vs/editor/contrib/format/common/formatActions.ts index fd801055ec68e4bd29038c8372748aa7ce790f17..b01ce74fa793f2730d892a03e1be8eadeec18db6 100644 --- a/src/vs/editor/contrib/format/common/formatActions.ts +++ b/src/vs/editor/contrib/format/common/formatActions.ts @@ -141,7 +141,7 @@ export class FormatAction extends EditorAction { private _disposables: IDisposable[]; constructor(descriptor:editorCommon.IEditorActionDescriptorData, editor:editorCommon.ICommonCodeEditor) { - super(descriptor, editor, Behaviour.WidgetFocus | Behaviour.Writeable); + super(descriptor, editor, Behaviour.WidgetFocus | Behaviour.Writeable | Behaviour.UpdateOnModelChange); this._disposables = [ DocumentFormattingEditProviderRegistry.onDidChange(() => this.resetEnablementState()), DocumentRangeFormattingEditProviderRegistry.onDidChange(() => this.resetEnablementState()) @@ -152,6 +152,15 @@ export class FormatAction extends EditorAction { super.dispose(); this._disposables = dispose(this._disposables); } + public isSupported(): boolean { + return ( + ( + DocumentFormattingEditProviderRegistry.has(this.editor.getModel()) + || DocumentRangeFormattingEditProviderRegistry.has(this.editor.getModel()) + ) + && super.isSupported() + ); + } public run(): TPromise { diff --git a/src/vs/editor/contrib/quickOpen/browser/quickOutline.ts b/src/vs/editor/contrib/quickOpen/browser/quickOutline.ts index f839fe25a94dfac7a53b5c0eaab67fd40c4e1d2f..4569e44efd5d35835aaa67fe4308109dead014a4 100644 --- a/src/vs/editor/contrib/quickOpen/browser/quickOutline.ts +++ b/src/vs/editor/contrib/quickOpen/browser/quickOutline.ts @@ -115,6 +115,9 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction { constructor(descriptor: IEditorActionDescriptorData, editor: ICommonCodeEditor) { super(descriptor, editor, nls.localize('QuickOutlineAction.label', "Go to Symbol...")); } + public isSupported(): boolean { + return DocumentSymbolProviderRegistry.has(this.editor.getModel()) && super.isSupported(); + } public run(): TPromise { let model = this.editor.getModel(); diff --git a/src/vs/editor/contrib/rename/browser/rename.ts b/src/vs/editor/contrib/rename/browser/rename.ts index 1197c8feaeca6f2602e164c97cfdb566cca074f6..b2d441e1c69728044e163eafb535776de975fc60 100644 --- a/src/vs/editor/contrib/rename/browser/rename.ts +++ b/src/vs/editor/contrib/rename/browser/rename.ts @@ -20,6 +20,7 @@ import {IEditorActionDescriptorData, IRange} from 'vs/editor/common/editorCommon import {CommonEditorRegistry, ContextKey} from 'vs/editor/common/editorCommonExtensions'; import {KEYBINDING_CONTEXT_EDITOR_READONLY, ModeContextKeys} from 'vs/editor/common/editorCommon'; import {BulkEdit, createBulkEdit} from 'vs/editor/common/services/bulkEdit'; +import {RenameProviderRegistry} from 'vs/editor/common/modes'; import {ICodeEditor} from 'vs/editor/browser/editorBrowser'; import {rename} from '../common/rename'; import RenameInputField from './renameInputField'; @@ -52,6 +53,14 @@ export class RenameAction extends EditorAction { this._renameInputVisible = keybindingService.createKey(CONTEXT_RENAME_INPUT_VISIBLE, false); } + public isSupported(): boolean { + return RenameProviderRegistry.has(this.editor.getModel()) && !this.editor.getModel().hasEditableRange() && super.isSupported(); + } + + public getEnablementState(): boolean { + return RenameProviderRegistry.has(this.editor.getModel()); + } + public run(event?: any): TPromise { const selection = this.editor.getSelection(),