提交 c6456a0a 编写于 作者: J Johannes Rieken

bring back the isSupported method cos they are used for the F1 list

上级 0c861881
......@@ -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<boolean> {
......
......@@ -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<boolean> {
let model = this.editor.getModel();
......
......@@ -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<any> {
const selection = this.editor.getSelection(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册