未验证 提交 48024f70 编写于 作者: A Andre Weinand 提交者: GitHub

Merge branch 'master' into fix/78014/Fix-Special-Character

......@@ -76,8 +76,8 @@
"problemMatcher": []
},
{
"type": "gulp",
"task": "electron",
"type": "npm",
"script": "electron",
"label": "Download electron"
},
{
......
......@@ -25,10 +25,16 @@ import { withNullAsUndefined } from 'vs/base/common/types';
export type ServicesAccessor = InstantiationServicesAccessor;
export type IEditorContributionCtor = IConstructorSignature1<ICodeEditor, IEditorContribution>;
export type IDiffEditorContributionCtor = IConstructorSignature1<IDiffEditor, IDiffEditorContribution>;
export type EditorTelemetryDataFragment = {
target: { classification: 'SystemMetaData', purpose: 'FeatureInsight', };
snippet: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true, };
};
export interface IEditorContributionDescription {
id: string;
ctor: IEditorContributionCtor;
}
export interface IDiffEditorContributionDescription {
id: string;
ctor: IDiffEditorContributionCtor;
}
//#region Command
......@@ -297,12 +303,12 @@ export function registerInstantiatedEditorAction(editorAction: EditorAction): vo
EditorContributionRegistry.INSTANCE.registerEditorAction(editorAction);
}
export function registerEditorContribution(ctor: IEditorContributionCtor): void {
EditorContributionRegistry.INSTANCE.registerEditorContribution(ctor);
export function registerEditorContribution(id: string, ctor: IEditorContributionCtor): void {
EditorContributionRegistry.INSTANCE.registerEditorContribution(id, ctor);
}
export function registerDiffEditorContribution(ctor: IDiffEditorContributionCtor): void {
EditorContributionRegistry.INSTANCE.registerDiffEditorContribution(ctor);
export function registerDiffEditorContribution(id: string, ctor: IDiffEditorContributionCtor): void {
EditorContributionRegistry.INSTANCE.registerDiffEditorContribution(id, ctor);
}
export namespace EditorExtensionsRegistry {
......@@ -315,11 +321,11 @@ export namespace EditorExtensionsRegistry {
return EditorContributionRegistry.INSTANCE.getEditorActions();
}
export function getEditorContributions(): IEditorContributionCtor[] {
export function getEditorContributions(): IEditorContributionDescription[] {
return EditorContributionRegistry.INSTANCE.getEditorContributions();
}
export function getDiffEditorContributions(): IDiffEditorContributionCtor[] {
export function getDiffEditorContributions(): IDiffEditorContributionDescription[] {
return EditorContributionRegistry.INSTANCE.getDiffEditorContributions();
}
}
......@@ -333,8 +339,8 @@ class EditorContributionRegistry {
public static readonly INSTANCE = new EditorContributionRegistry();
private readonly editorContributions: IEditorContributionCtor[];
private readonly diffEditorContributions: IDiffEditorContributionCtor[];
private readonly editorContributions: IEditorContributionDescription[];
private readonly diffEditorContributions: IDiffEditorContributionDescription[];
private readonly editorActions: EditorAction[];
private readonly editorCommands: { [commandId: string]: EditorCommand; };
......@@ -345,19 +351,19 @@ class EditorContributionRegistry {
this.editorCommands = Object.create(null);
}
public registerEditorContribution(ctor: IEditorContributionCtor): void {
this.editorContributions.push(ctor);
public registerEditorContribution(id: string, ctor: IEditorContributionCtor): void {
this.editorContributions.push({ id, ctor });
}
public getEditorContributions(): IEditorContributionCtor[] {
public getEditorContributions(): IEditorContributionDescription[] {
return this.editorContributions.slice(0);
}
public registerDiffEditorContribution(ctor: IDiffEditorContributionCtor): void {
this.diffEditorContributions.push(ctor);
public registerDiffEditorContribution(id: string, ctor: IDiffEditorContributionCtor): void {
this.diffEditorContributions.push({ id, ctor });
}
public getDiffEditorContributions(): IDiffEditorContributionCtor[] {
public getDiffEditorContributions(): IDiffEditorContributionDescription[] {
return this.diffEditorContributions.slice(0);
}
......
......@@ -18,7 +18,7 @@ import { Schemas } from 'vs/base/common/network';
import { Configuration } from 'vs/editor/browser/config/configuration';
import { CoreEditorCommand } from 'vs/editor/browser/controller/coreCommands';
import * as editorBrowser from 'vs/editor/browser/editorBrowser';
import { EditorExtensionsRegistry, IEditorContributionCtor } from 'vs/editor/browser/editorExtensions';
import { EditorExtensionsRegistry, IEditorContributionDescription } from 'vs/editor/browser/editorExtensions';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { ICommandDelegate } from 'vs/editor/browser/view/viewController';
import { IContentWidgetData, IOverlayWidgetData, View } from 'vs/editor/browser/view/viewImpl';
......@@ -67,7 +67,7 @@ export interface ICodeEditorWidgetOptions {
* Contributions to instantiate.
* Defaults to EditorExtensionsRegistry.getEditorContributions().
*/
contributions?: IEditorContributionCtor[];
contributions?: IEditorContributionDescription[];
/**
* Telemetry data associated with this CodeEditorWidget.
......@@ -294,17 +294,16 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this._contentWidgets = {};
this._overlayWidgets = {};
let contributions: IEditorContributionCtor[];
let contributions: IEditorContributionDescription[];
if (Array.isArray(codeEditorWidgetOptions.contributions)) {
contributions = codeEditorWidgetOptions.contributions;
} else {
contributions = EditorExtensionsRegistry.getEditorContributions();
}
for (let i = 0, len = contributions.length; i < len; i++) {
const ctor = contributions[i];
for (const desc of contributions) {
try {
const contribution = this._instantiationService.createInstance(ctor, this);
this._contributions[contribution.getId()] = contribution;
const contribution = this._instantiationService.createInstance(desc.ctor, this);
this._contributions[desc.id] = contribution;
} catch (err) {
onUnexpectedError(err);
}
......
......@@ -44,7 +44,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import { IDiffLinesChange, InlineDiffMargin } from 'vs/editor/browser/widget/inlineDiffMargin';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { Constants } from 'vs/base/common/uint';
import { IDiffEditorContributionCtor, EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions';
import { EditorExtensionsRegistry, IDiffEditorContributionDescription } from 'vs/editor/browser/editorExtensions';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IEditorProgressService, IProgressRunner } from 'vs/platform/progress/common/progress';
......@@ -380,10 +380,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this._containerDomElement.className = DiffEditorWidget._getClassName(this._themeService.getTheme(), this._renderSideBySide);
}));
const contributions: IDiffEditorContributionCtor[] = EditorExtensionsRegistry.getDiffEditorContributions();
for (const ctor of contributions) {
const contributions: IDiffEditorContributionDescription[] = EditorExtensionsRegistry.getDiffEditorContributions();
for (const desc of contributions) {
try {
this._register(instantiationService.createInstance(ctor, this));
this._register(instantiationService.createInstance(desc.ctor, this));
} catch (err) {
onUnexpectedError(err);
}
......
......@@ -488,10 +488,6 @@ export interface IDiffEditor extends IEditor {
* An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed.
*/
export interface IEditorContribution {
/**
* Get a unique identifier for this contribution.
*/
getId(): string;
/**
* Dispose this contribution.
*/
......@@ -511,10 +507,6 @@ export interface IEditorContribution {
* @internal
*/
export interface IDiffEditorContribution {
/**
* Get a unique identifier for this contribution.
*/
getId(): string;
/**
* Dispose this contribution.
*/
......
......@@ -82,7 +82,7 @@ class BracketsData {
}
export class BracketMatchingController extends Disposable implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.bracketMatchingController';
public static readonly ID = 'editor.contrib.bracketMatchingController';
public static get(editor: ICodeEditor): BracketMatchingController {
return editor.getContribution<BracketMatchingController>(BracketMatchingController.ID);
......@@ -140,10 +140,6 @@ export class BracketMatchingController extends Disposable implements editorCommo
}));
}
public getId(): string {
return BracketMatchingController.ID;
}
public jumpToBracket(): void {
if (!this._editor.hasModel()) {
return;
......@@ -311,7 +307,7 @@ export class BracketMatchingController extends Disposable implements editorCommo
}
}
registerEditorContribution(BracketMatchingController);
registerEditorContribution(BracketMatchingController.ID, BracketMatchingController);
registerEditorAction(SelectToBracketAction);
registerEditorAction(JumpToBracketAction);
registerThemingParticipant((theme, collector) => {
......
......@@ -34,7 +34,7 @@ suite('bracket matching', () => {
let model = TextModel.createFromString('var x = (3 + (5-7)) + ((5+3)+5);', undefined, mode.getLanguageIdentifier());
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController);
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
// start on closing bracket
editor.setPosition(new Position(1, 20));
......@@ -66,7 +66,7 @@ suite('bracket matching', () => {
let model = TextModel.createFromString('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier());
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController);
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
// start position between brackets
editor.setPosition(new Position(1, 16));
......@@ -103,7 +103,7 @@ suite('bracket matching', () => {
let model = TextModel.createFromString('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier());
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController);
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
// start position in open brackets
......@@ -148,7 +148,7 @@ suite('bracket matching', () => {
let model = TextModel.createFromString('{ } { } { }', undefined, mode.getLanguageIdentifier());
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController);
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
// cursors inside brackets become selections of the entire bracket contents
editor.setSelections([
......
......@@ -40,7 +40,7 @@ function contextKeyForSupportedActions(kind: CodeActionKind) {
export class QuickFixController extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.quickFixController';
public static readonly ID = 'editor.contrib.quickFixController';
public static get(editor: ICodeEditor): QuickFixController {
return editor.getContribution<QuickFixController>(QuickFixController.ID);
......@@ -90,10 +90,6 @@ export class QuickFixController extends Disposable implements IEditorContributio
return this._ui.getValue().showCodeActionList(actions, at);
}
public getId(): string {
return QuickFixController.ID;
}
public manualTriggerAtCurrentPosition(
notAvailableMessage: string,
filter?: CodeActionFilter,
......
......@@ -7,7 +7,7 @@ import { registerEditorAction, registerEditorCommand, registerEditorContribution
import { CodeActionCommand, OrganizeImportsAction, QuickFixAction, QuickFixController, RefactorAction, SourceAction, AutoFixAction, FixAllAction } from 'vs/editor/contrib/codeAction/codeActionCommands';
registerEditorContribution(QuickFixController);
registerEditorContribution(QuickFixController.ID, QuickFixController);
registerEditorAction(QuickFixAction);
registerEditorAction(RefactorAction);
registerEditorAction(SourceAction);
......
......@@ -21,7 +21,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
export class CodeLensContribution implements editorCommon.IEditorContribution {
private static readonly ID: string = 'css.editor.codeLens';
public static readonly ID: string = 'css.editor.codeLens';
private _isEnabled: boolean;
......@@ -78,10 +78,6 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
dispose(this._currentCodeLensModel);
}
getId(): string {
return CodeLensContribution.ID;
}
private _onModelChange(): void {
this._localDispose();
......@@ -366,4 +362,4 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
}
}
registerEditorContribution(CodeLensContribution);
registerEditorContribution(CodeLensContribution.ID, CodeLensContribution);
......@@ -25,7 +25,7 @@ const MAX_DECORATORS = 500;
export class ColorDetector extends Disposable implements IEditorContribution {
private static readonly ID: string = 'editor.contrib.colorDetector';
public static readonly ID: string = 'editor.contrib.colorDetector';
static readonly RECOMPUTE_TIME = 1000; // ms
......@@ -88,10 +88,6 @@ export class ColorDetector extends Disposable implements IEditorContribution {
return this._editor.getOption(EditorOption.colorDecorators);
}
getId(): string {
return ColorDetector.ID;
}
static get(editor: ICodeEditor): ColorDetector {
return editor.getContribution<ColorDetector>(this.ID);
}
......@@ -247,4 +243,4 @@ export class ColorDetector extends Disposable implements IEditorContribution {
}
}
registerEditorContribution(ColorDetector);
registerEditorContribution(ColorDetector.ID, ColorDetector);
......@@ -26,7 +26,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
export class ContextMenuController implements IEditorContribution {
private static readonly ID = 'editor.contrib.contextmenu';
public static readonly ID = 'editor.contrib.contextmenu';
public static get(editor: ICodeEditor): ContextMenuController {
return editor.getContribution<ContextMenuController>(ContextMenuController.ID);
......@@ -209,10 +209,6 @@ export class ContextMenuController implements IEditorContribution {
return this._keybindingService.lookupKeybinding(action.id);
}
public getId(): string {
return ContextMenuController.ID;
}
public dispose(): void {
if (this._contextMenuIsBeingShownCount > 0) {
this._contextViewService.hideContextView();
......@@ -244,5 +240,5 @@ class ShowContextMenu extends EditorAction {
}
}
registerEditorContribution(ContextMenuController);
registerEditorContribution(ContextMenuController.ID, ContextMenuController);
registerEditorAction(ShowContextMenu);
......@@ -28,7 +28,7 @@ class CursorState {
export class CursorUndoController extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.cursorUndoController';
public static readonly ID = 'editor.contrib.cursorUndoController';
public static get(editor: ICodeEditor): CursorUndoController {
return editor.getContribution<CursorUndoController>(CursorUndoController.ID);
......@@ -79,10 +79,6 @@ export class CursorUndoController extends Disposable implements IEditorContribut
return new CursorState(this._editor.getSelections());
}
public getId(): string {
return CursorUndoController.ID;
}
public cursorUndo(): void {
if (!this._editor.hasModel()) {
return;
......@@ -124,5 +120,5 @@ export class CursorUndo extends EditorAction {
}
}
registerEditorContribution(CursorUndoController);
registerEditorContribution(CursorUndoController.ID, CursorUndoController);
registerEditorAction(CursorUndo);
......@@ -31,7 +31,7 @@ function hasTriggerModifier(e: IKeyboardEvent | IMouseEvent): boolean {
export class DragAndDropController extends Disposable implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.dragAndDrop';
public static readonly ID = 'editor.contrib.dragAndDrop';
private readonly _editor: ICodeEditor;
private _dragSelection: Selection | null;
......@@ -219,10 +219,6 @@ export class DragAndDropController extends Disposable implements editorCommon.IE
target.type === MouseTargetType.GUTTER_LINE_DECORATIONS;
}
public getId(): string {
return DragAndDropController.ID;
}
public dispose(): void {
this._removeDecoration();
this._dragSelection = null;
......@@ -232,4 +228,4 @@ export class DragAndDropController extends Disposable implements editorCommon.IE
}
}
registerEditorContribution(DragAndDropController);
registerEditorContribution(DragAndDropController.ID, DragAndDropController);
......@@ -70,7 +70,7 @@ export interface IFindStartOptions {
export class CommonFindController extends Disposable implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.findController';
public static readonly ID = 'editor.contrib.findController';
protected _editor: ICodeEditor;
private readonly _findWidgetVisible: IContextKey<boolean>;
......@@ -143,10 +143,6 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
}
}
public getId(): string {
return CommonFindController.ID;
}
private _onStateChanged(e: FindReplaceStateChangedEvent): void {
this.saveQueryState(e);
......@@ -735,7 +731,7 @@ export class StartFindReplaceAction extends EditorAction {
}
}
registerEditorContribution(FindController);
registerEditorContribution(CommonFindController.ID, FindController);
registerEditorAction(StartFindAction);
registerEditorAction(StartFindWithSelectionAction);
......
......@@ -89,7 +89,7 @@ suite('FindController', () => {
assert.ok(true);
return;
}
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let startFindAction = new StartFindAction();
// I select ABC on the first line
editor.setSelection(new Selection(1, 1, 1, 4));
......@@ -115,7 +115,7 @@ suite('FindController', () => {
return;
}
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let findState = findController.getState();
let nextMatchFindAction = new NextMatchFindAction();
......@@ -141,7 +141,7 @@ suite('FindController', () => {
return;
}
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let findState = findController.getState();
findState.change({ searchString: 'ABC' }, true);
......@@ -161,7 +161,7 @@ suite('FindController', () => {
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
// The cursor is at the very top, of the file, at the first ABC
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let findState = findController.getState();
let startFindAction = new StartFindAction();
let nextMatchFindAction = new NextMatchFindAction();
......@@ -215,7 +215,7 @@ suite('FindController', () => {
'import nls = require(\'vs/nls\');'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let nextMatchFindAction = new NextMatchFindAction();
editor.setPosition({
......@@ -240,7 +240,7 @@ suite('FindController', () => {
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let startFindAction = new StartFindAction();
let nextMatchFindAction = new NextMatchFindAction();
......@@ -264,7 +264,7 @@ suite('FindController', () => {
'test',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
let testRegexString = 'tes.';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let nextMatchFindAction = new NextMatchFindAction();
let startFindReplaceAction = new StartFindReplaceAction();
......@@ -294,7 +294,7 @@ suite('FindController', () => {
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
findController.start({
forceRevealReplace: false,
seedSearchStringFromSelection: false,
......@@ -322,7 +322,7 @@ suite('FindController', () => {
'HRESULT OnAmbientPropertyChange(DISPID dispid);'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let startFindAction = new StartFindAction();
startFindAction.run(null, editor);
......@@ -349,7 +349,7 @@ suite('FindController', () => {
'line3'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let startFindAction = new StartFindAction();
startFindAction.run(null, editor);
......@@ -376,7 +376,7 @@ suite('FindController', () => {
'([funny]'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let nextSelectionMatchFindAction = new NextSelectionMatchFindAction();
// toggle regex
......@@ -403,7 +403,7 @@ suite('FindController', () => {
'([funny]'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
clipboardState = '';
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let startFindAction = new StartFindAction();
let nextSelectionMatchFindAction = new NextSelectionMatchFindAction();
......@@ -454,7 +454,7 @@ suite('FindController query options persistence', () => {
], { serviceCollection: serviceCollection }, (editor, cursor) => {
queryState = { 'editor.isRegex': false, 'editor.matchCase': true, 'editor.wholeWord': false };
// The cursor is at the very top, of the file, at the first ABC
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let findState = findController.getState();
let startFindAction = new StartFindAction();
......@@ -481,7 +481,7 @@ suite('FindController query options persistence', () => {
], { serviceCollection: serviceCollection }, (editor, cursor) => {
queryState = { 'editor.isRegex': false, 'editor.matchCase': false, 'editor.wholeWord': true };
// The cursor is at the very top, of the file, at the first ABC
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
let findState = findController.getState();
let startFindAction = new StartFindAction();
......@@ -506,7 +506,7 @@ suite('FindController query options persistence', () => {
], { serviceCollection: serviceCollection }, (editor, cursor) => {
queryState = { 'editor.isRegex': false, 'editor.matchCase': false, 'editor.wholeWord': true };
// The cursor is at the very top, of the file, at the first ABC
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
findController.toggleRegex();
assert.equal(queryState['editor.isRegex'], true);
......@@ -522,7 +522,7 @@ suite('FindController query options persistence', () => {
], { serviceCollection: serviceCollection, find: { autoFindInSelection: true, globalFindClipboard: false } }, (editor, cursor) => {
// clipboardState = '';
editor.setSelection(new Range(1, 1, 2, 1));
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
findController.start({
forceRevealReplace: false,
......@@ -545,7 +545,7 @@ suite('FindController query options persistence', () => {
], { serviceCollection: serviceCollection, find: { autoFindInSelection: true, globalFindClipboard: false } }, (editor, cursor) => {
// clipboardState = '';
editor.setSelection(new Range(1, 2, 1, 2));
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
findController.start({
forceRevealReplace: false,
......@@ -568,7 +568,7 @@ suite('FindController query options persistence', () => {
], { serviceCollection: serviceCollection, find: { autoFindInSelection: true, globalFindClipboard: false } }, (editor, cursor) => {
// clipboardState = '';
editor.setSelection(new Range(1, 2, 1, 3));
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
findController.start({
forceRevealReplace: false,
......
......@@ -34,7 +34,6 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
const CONTEXT_FOLDING_ENABLED = new RawContextKey<boolean>('foldingEnabled', false);
export const ID = 'editor.contrib.folding';
export interface RangeProvider {
readonly id: string;
......@@ -50,11 +49,12 @@ interface FoldingStateMemento {
export class FoldingController extends Disposable implements IEditorContribution {
static readonly MAX_FOLDING_REGIONS = 5000;
public static ID = 'editor.contrib.folding';
static readonly MAX_FOLDING_REGIONS = 5000;
public static get(editor: ICodeEditor): FoldingController {
return editor.getContribution<FoldingController>(ID);
return editor.getContribution<FoldingController>(FoldingController.ID);
}
private readonly editor: ICodeEditor;
......@@ -134,10 +134,6 @@ export class FoldingController extends Disposable implements IEditorContribution
this.onModelChanged();
}
public getId(): string {
return ID;
}
/**
* Store view state.
*/
......@@ -856,7 +852,7 @@ class FoldLevelAction extends FoldingAction<void> {
}
}
registerEditorContribution(FoldingController);
registerEditorContribution(FoldingController.ID, FoldingController);
registerEditorAction(UnfoldAction);
registerEditorAction(UnFoldRecursivelyAction);
registerEditorAction(FoldAction);
......
......@@ -28,7 +28,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
class FormatOnType implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.autoFormat';
public static readonly ID = 'editor.contrib.autoFormat';
private readonly _editor: ICodeEditor;
private readonly _callOnDispose = new DisposableStore();
......@@ -45,10 +45,6 @@ class FormatOnType implements editorCommon.IEditorContribution {
this._callOnDispose.add(OnTypeFormattingEditProviderRegistry.onDidChange(this._update, this));
}
getId(): string {
return FormatOnType.ID;
}
dispose(): void {
this._callOnDispose.dispose();
this._callOnModel.dispose();
......@@ -155,7 +151,7 @@ class FormatOnType implements editorCommon.IEditorContribution {
class FormatOnPaste implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.formatOnPaste';
public static readonly ID = 'editor.contrib.formatOnPaste';
private readonly _callOnDispose = new DisposableStore();
private readonly _callOnModel = new DisposableStore();
......@@ -170,10 +166,6 @@ class FormatOnPaste implements editorCommon.IEditorContribution {
this._callOnDispose.add(DocumentRangeFormattingEditProviderRegistry.onDidChange(this._update, this));
}
getId(): string {
return FormatOnPaste.ID;
}
dispose(): void {
this._callOnDispose.dispose();
this._callOnModel.dispose();
......@@ -278,8 +270,8 @@ class FormatSelectionAction extends EditorAction {
}
}
registerEditorContribution(FormatOnType);
registerEditorContribution(FormatOnPaste);
registerEditorContribution(FormatOnType.ID, FormatOnType);
registerEditorContribution(FormatOnPaste.ID, FormatOnPaste);
registerEditorAction(FormatDocumentAction);
registerEditorAction(FormatSelectionAction);
......
......@@ -29,7 +29,7 @@ import { withNullAsUndefined } from 'vs/base/common/types';
class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.gotodefinitionwithmouse';
public static readonly ID = 'editor.contrib.gotodefinitionwithmouse';
static readonly MAX_SOURCE_PREVIEW_LINES = 8;
private readonly editor: ICodeEditor;
......@@ -295,16 +295,12 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
return this.editor.invokeWithinContext(accessor => action.run(accessor, this.editor));
}
public getId(): string {
return GotoDefinitionWithMouseEditorContribution.ID;
}
public dispose(): void {
this.toUnhook.dispose();
}
}
registerEditorContribution(GotoDefinitionWithMouseEditorContribution);
registerEditorContribution(GotoDefinitionWithMouseEditorContribution.ID, GotoDefinitionWithMouseEditorContribution);
registerThemingParticipant((theme, collector) => {
const activeLinkForeground = theme.getColor(editorActiveLinkForeground);
......
......@@ -191,7 +191,7 @@ class MarkerModel {
export class MarkerController implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.markerController';
public static readonly ID = 'editor.contrib.markerController';
public static get(editor: ICodeEditor): MarkerController {
return editor.getContribution<MarkerController>(MarkerController.ID);
......@@ -215,10 +215,6 @@ export class MarkerController implements editorCommon.IEditorContribution {
this._widgetVisible = CONTEXT_MARKERS_NAVIGATION_VISIBLE.bindTo(this._contextKeyService);
}
public getId(): string {
return MarkerController.ID;
}
public dispose(): void {
this._cleanUp();
this._disposeOnClose.dispose();
......@@ -479,7 +475,7 @@ class PrevMarkerInFilesAction extends MarkerNavigationAction {
}
}
registerEditorContribution(MarkerController);
registerEditorContribution(MarkerController.ID, MarkerController);
registerEditorAction(NextMarkerAction);
registerEditorAction(PrevMarkerAction);
registerEditorAction(NextMarkerInFilesAction);
......
......@@ -29,7 +29,7 @@ import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibi
export class ModesHoverController implements IEditorContribution {
private static readonly ID = 'editor.contrib.hover';
public static readonly ID = 'editor.contrib.hover';
private readonly _toUnhook = new DisposableStore();
private readonly _didChangeConfigurationHandler: IDisposable;
......@@ -212,10 +212,6 @@ export class ModesHoverController implements IEditorContribution {
this.contentWidget.startShowingAt(range, mode, focus);
}
public getId(): string {
return ModesHoverController.ID;
}
public dispose(): void {
this._unhookEvents();
this._toUnhook.dispose();
......@@ -262,7 +258,7 @@ class ShowHoverAction extends EditorAction {
}
}
registerEditorContribution(ModesHoverController);
registerEditorContribution(ModesHoverController.ID, ModesHoverController);
registerEditorAction(ShowHoverAction);
// theming
......
......@@ -24,7 +24,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
class InPlaceReplaceController implements IEditorContribution {
private static readonly ID = 'editor.contrib.inPlaceReplaceController';
public static readonly ID = 'editor.contrib.inPlaceReplaceController';
static get(editor: ICodeEditor): InPlaceReplaceController {
return editor.getContribution<InPlaceReplaceController>(InPlaceReplaceController.ID);
......@@ -51,10 +51,6 @@ class InPlaceReplaceController implements IEditorContribution {
public dispose(): void {
}
public getId(): string {
return InPlaceReplaceController.ID;
}
public run(source: string, up: boolean): Promise<void> | undefined {
// cancel any pending request
......@@ -183,7 +179,7 @@ class InPlaceReplaceDown extends EditorAction {
}
}
registerEditorContribution(InPlaceReplaceController);
registerEditorContribution(InPlaceReplaceController.ID, InPlaceReplaceController);
registerEditorAction(InPlaceReplaceUp);
registerEditorAction(InPlaceReplaceDown);
......
......@@ -422,7 +422,7 @@ export class AutoIndentOnPasteCommand implements ICommand {
}
export class AutoIndentOnPaste implements IEditorContribution {
private static readonly ID = 'editor.contrib.autoIndentOnPaste';
public static readonly ID = 'editor.contrib.autoIndentOnPaste';
private readonly editor: ICodeEditor;
private readonly callOnDispose = new DisposableStore();
......@@ -604,10 +604,6 @@ export class AutoIndentOnPaste implements IEditorContribution {
return false;
}
public getId(): string {
return AutoIndentOnPaste.ID;
}
public dispose(): void {
this.callOnDispose.dispose();
this.callOnModel.dispose();
......@@ -681,7 +677,7 @@ export class IndentationToTabsCommand implements ICommand {
}
}
registerEditorContribution(AutoIndentOnPaste);
registerEditorContribution(AutoIndentOnPaste.ID, AutoIndentOnPaste);
registerEditorAction(IndentationToSpacesAction);
registerEditorAction(IndentationToTabsAction);
registerEditorAction(IndentUsingTabs);
......
......@@ -99,7 +99,7 @@ class LinkOccurrence {
class LinkDetector implements editorCommon.IEditorContribution {
private static readonly ID: string = 'editor.linkDetector';
public static readonly ID: string = 'editor.linkDetector';
public static get(editor: ICodeEditor): LinkDetector {
return editor.getContribution<LinkDetector>(LinkDetector.ID);
......@@ -170,10 +170,6 @@ class LinkDetector implements editorCommon.IEditorContribution {
this.beginCompute();
}
public getId(): string {
return LinkDetector.ID;
}
private onModelChanged(): void {
this.currentOccurrences = {};
this.activeLinkDecorationId = null;
......@@ -390,7 +386,7 @@ class OpenLinkAction extends EditorAction {
}
}
registerEditorContribution(LinkDetector);
registerEditorContribution(LinkDetector.ID, LinkDetector);
registerEditorAction(OpenLinkAction);
registerThemingParticipant((theme, collector) => {
......
......@@ -21,20 +21,16 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
export class MessageController extends Disposable implements editorCommon.IEditorContribution {
private static readonly _id = 'editor.contrib.messageController';
public static readonly ID = 'editor.contrib.messageController';
static readonly MESSAGE_VISIBLE = new RawContextKey<boolean>('messageVisible', false);
static get(editor: ICodeEditor): MessageController {
return editor.getContribution<MessageController>(MessageController._id);
return editor.getContribution<MessageController>(MessageController.ID);
}
private readonly closeTimeout = 3000; // close after 3s
getId(): string {
return MessageController._id;
}
private readonly _editor: ICodeEditor;
private readonly _visible: IContextKey<boolean>;
private readonly _messageWidget = this._register(new MutableDisposable<MessageWidget>());
......@@ -184,7 +180,7 @@ class MessageWidget implements IContentWidget {
}
}
registerEditorContribution(MessageController);
registerEditorContribution(MessageController.ID, MessageController);
registerThemingParticipant((theme, collector) => {
const border = theme.getColor(inputValidationInfoBorder);
......
......@@ -423,7 +423,7 @@ export class MultiCursorSession {
export class MultiCursorSelectionController extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.multiCursorController';
public static readonly ID = 'editor.contrib.multiCursorController';
private readonly _editor: ICodeEditor;
private _ignoreSelectionChange: boolean;
......@@ -446,10 +446,6 @@ export class MultiCursorSelectionController extends Disposable implements IEdito
super.dispose();
}
public getId(): string {
return MultiCursorSelectionController.ID;
}
private _beginSessionIfNeeded(findController: CommonFindController): void {
if (!this._session) {
// Create a new session
......@@ -798,7 +794,7 @@ class SelectionHighlighterState {
}
export class SelectionHighlighter extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.selectionHighlighter';
public static readonly ID = 'editor.contrib.selectionHighlighter';
private readonly editor: ICodeEditor;
private _isEnabled: boolean;
......@@ -848,10 +844,6 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
}));
}
public getId(): string {
return SelectionHighlighter.ID;
}
private _update(): void {
this._setState(SelectionHighlighter._createState(this._isEnabled, this.editor));
}
......@@ -1041,8 +1033,8 @@ function getValueInRange(model: ITextModel, range: Range, toLowerCase: boolean):
return (toLowerCase ? text.toLowerCase() : text);
}
registerEditorContribution(MultiCursorSelectionController);
registerEditorContribution(SelectionHighlighter);
registerEditorContribution(MultiCursorSelectionController.ID, MultiCursorSelectionController);
registerEditorContribution(SelectionHighlighter.ID, SelectionHighlighter);
registerEditorAction(InsertCursorAbove);
registerEditorAction(InsertCursorBelow);
......
......@@ -79,8 +79,8 @@ suite('Multicursor selection', () => {
'var z = (3 * 5)',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController);
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
let selectHighlightsAction = new SelectHighlightsAction();
editor.setSelection(new Selection(2, 9, 2, 16));
......@@ -109,8 +109,8 @@ suite('Multicursor selection', () => {
'nothing'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController);
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
let selectHighlightsAction = new SelectHighlightsAction();
editor.setSelection(new Selection(1, 1, 1, 1));
......@@ -143,8 +143,8 @@ suite('Multicursor selection', () => {
'rty'
], { serviceCollection: serviceCollection }, (editor, cursor) => {
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController);
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
let addSelectionToNextFindMatch = new AddSelectionToNextFindMatchAction();
editor.setSelection(new Selection(2, 1, 3, 4));
......@@ -171,8 +171,8 @@ suite('Multicursor selection', () => {
'abcabc',
], { serviceCollection: serviceCollection }, (editor, cursor) => {
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController);
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
let addSelectionToNextFindMatch = new AddSelectionToNextFindMatchAction();
editor.setSelection(new Selection(1, 1, 1, 4));
......@@ -228,8 +228,8 @@ suite('Multicursor selection', () => {
editor.getModel()!.setEOL(EndOfLineSequence.CRLF);
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController);
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
let addSelectionToNextFindMatch = new AddSelectionToNextFindMatchAction();
editor.setSelection(new Selection(2, 1, 3, 4));
......@@ -251,8 +251,8 @@ suite('Multicursor selection', () => {
function testMulticursor(text: string[], callback: (editor: TestCodeEditor, findController: CommonFindController) => void): void {
withTestCodeEditor(text, { serviceCollection: serviceCollection }, (editor, cursor) => {
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController);
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
callback(editor, findController);
......
......@@ -20,7 +20,7 @@ import { TriggerContext } from 'vs/editor/contrib/parameterHints/parameterHintsM
class ParameterHintsController extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.controller.parameterHints';
public static readonly ID = 'editor.controller.parameterHints';
public static get(editor: ICodeEditor): ParameterHintsController {
return editor.getContribution<ParameterHintsController>(ParameterHintsController.ID);
......@@ -35,10 +35,6 @@ class ParameterHintsController extends Disposable implements IEditorContribution
this.widget = this._register(instantiationService.createInstance(ParameterHintsWidget, this.editor));
}
getId(): string {
return ParameterHintsController.ID;
}
cancel(): void {
this.widget.cancel();
}
......@@ -82,7 +78,7 @@ export class TriggerParameterHintsAction extends EditorAction {
}
}
registerEditorContribution(ParameterHintsController);
registerEditorContribution(ParameterHintsController.ID, ParameterHintsController);
registerEditorAction(TriggerParameterHintsAction);
const weight = KeybindingWeight.EditorContrib + 75;
......
......@@ -37,7 +37,7 @@ export const defaultReferenceSearchOptions: RequestOptions = {
export class ReferenceController implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.referenceController';
public static readonly ID = 'editor.contrib.referenceController';
constructor(
editor: ICodeEditor,
......@@ -50,10 +50,6 @@ export class ReferenceController implements editorCommon.IEditorContribution {
public dispose(): void {
}
public getId(): string {
return ReferenceController.ID;
}
}
export class ReferenceAction extends EditorAction {
......@@ -93,7 +89,7 @@ export class ReferenceAction extends EditorAction {
}
}
registerEditorContribution(ReferenceController);
registerEditorContribution(ReferenceController.ID, ReferenceController);
registerEditorAction(ReferenceAction);
......
......@@ -30,7 +30,7 @@ export interface RequestOptions {
export abstract class ReferencesController implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.referencesController';
public static readonly ID = 'editor.contrib.referencesController';
private readonly _disposables = new DisposableStore();
private readonly _editor: ICodeEditor;
......@@ -59,10 +59,6 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
this._referenceSearchVisible = ctxReferenceSearchVisible.bindTo(contextKeyService);
}
public getId(): string {
return ReferencesController.ID;
}
public dispose(): void {
this._referenceSearchVisible.reset();
dispose(this._disposables);
......
......@@ -97,7 +97,7 @@ export async function rename(model: ITextModel, position: Position, newName: str
class RenameController implements IEditorContribution {
private static readonly ID = 'editor.contrib.renameController';
public static readonly ID = 'editor.contrib.renameController';
static get(editor: ICodeEditor): RenameController {
return editor.getContribution<RenameController>(RenameController.ID);
......@@ -118,10 +118,6 @@ class RenameController implements IEditorContribution {
this._renameInputField = new IdleValue(() => this._dispoableStore.add(new RenameInputField(this.editor, this._themeService, this._contextKeyService)));
}
getId(): string {
return RenameController.ID;
}
dispose(): void {
this._dispoableStore.dispose();
this._cts.dispose(true);
......@@ -278,7 +274,7 @@ export class RenameAction extends EditorAction {
}
}
registerEditorContribution(RenameController);
registerEditorContribution(RenameController.ID, RenameController);
registerEditorAction(RenameAction);
const RenameCommand = EditorCommand.bindToContribution<RenameController>(RenameController.get);
......
......@@ -47,10 +47,10 @@ class SelectionRanges {
class SmartSelectController implements IEditorContribution {
private static readonly _id = 'editor.contrib.smartSelectController';
public static readonly ID = 'editor.contrib.smartSelectController';
static get(editor: ICodeEditor): SmartSelectController {
return editor.getContribution<SmartSelectController>(SmartSelectController._id);
return editor.getContribution<SmartSelectController>(SmartSelectController.ID);
}
private readonly _editor: ICodeEditor;
......@@ -67,10 +67,6 @@ class SmartSelectController implements IEditorContribution {
dispose(this._selectionListener);
}
getId(): string {
return SmartSelectController._id;
}
run(forward: boolean): Promise<void> | void {
if (!this._editor.hasModel()) {
return;
......@@ -210,7 +206,7 @@ class ShrinkSelectionAction extends AbstractSmartSelect {
}
}
registerEditorContribution(SmartSelectController);
registerEditorContribution(SmartSelectController.ID, SmartSelectController);
registerEditorAction(GrowSelectionAction);
registerEditorAction(ShrinkSelectionAction);
......
......@@ -40,8 +40,10 @@ const _defaultOptions: ISnippetInsertOptions = {
export class SnippetController2 implements IEditorContribution {
public static ID = 'snippetController2';
static get(editor: ICodeEditor): SnippetController2 {
return editor.getContribution<SnippetController2>('snippetController2');
return editor.getContribution<SnippetController2>(SnippetController2.ID);
}
static readonly InSnippetMode = new RawContextKey('inSnippetMode', false);
......@@ -75,10 +77,6 @@ export class SnippetController2 implements IEditorContribution {
this._snippetListener.dispose();
}
getId(): string {
return 'snippetController2';
}
insert(
template: string,
opts?: Partial<ISnippetInsertOptions>
......@@ -249,7 +247,7 @@ export class SnippetController2 implements IEditorContribution {
}
registerEditorContribution(SnippetController2);
registerEditorContribution(SnippetController2.ID, SnippetController2);
const CommandCtor = EditorCommand.bindToContribution<SnippetController2>(SnippetController2.get);
......
......@@ -45,7 +45,7 @@ suite('SnippetController', () => {
editor.getModel()!.updateOptions({
insertSpaces: false
});
let snippetController = editor.registerAndInstantiateContribution<TestSnippetController>(TestSnippetController);
let snippetController = editor.registerAndInstantiateContribution<TestSnippetController>(TestSnippetController.ID, TestSnippetController);
let template = [
'for (var ${1:index}; $1 < ${2:array}.length; $1++) {',
'\tvar element = $2[$1];',
......
......@@ -88,7 +88,7 @@ class LineSuffix {
export class SuggestController implements IEditorContribution {
private static readonly ID: string = 'editor.contrib.suggestController';
public static readonly ID: string = 'editor.contrib.suggestController';
public static get(editor: ICodeEditor): SuggestController {
return editor.getContribution<SuggestController>(SuggestController.ID);
......@@ -210,11 +210,6 @@ export class SuggestController implements IEditorContribution {
updateFromConfig();
}
getId(): string {
return SuggestController.ID;
}
dispose(): void {
this._alternatives.dispose();
this._toDispose.dispose();
......@@ -491,7 +486,7 @@ export class TriggerSuggestAction extends EditorAction {
}
}
registerEditorContribution(SuggestController);
registerEditorContribution(SuggestController.ID, SuggestController);
registerEditorAction(TriggerSuggestAction);
const weight = KeybindingWeight.EditorContrib + 90;
......
......@@ -59,7 +59,7 @@ function createMockEditor(model: TextModel): TestCodeEditor {
}],
),
});
editor.registerAndInstantiateContribution(SnippetController2);
editor.registerAndInstantiateContribution(SnippetController2.ID, SnippetController2);
return editor;
}
......@@ -679,8 +679,8 @@ suite('SuggestModel - TriggerAndCancelOracle', function () {
super._insertSuggestion(item, false, true, true, false);
}
}
const ctrl = <TestCtrl>editor.registerAndInstantiateContribution(TestCtrl);
editor.registerAndInstantiateContribution(SnippetController2);
const ctrl = <TestCtrl>editor.registerAndInstantiateContribution(TestCtrl.ID, TestCtrl);
editor.registerAndInstantiateContribution(SnippetController2.ID, SnippetController2);
await assertEvent(sugget.onDidSuggest, () => {
editor.setPosition({ lineNumber: 1, column: 3 });
......
......@@ -458,7 +458,7 @@ class WordHighlighter {
class WordHighlighterContribution extends Disposable implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.wordHighlighter';
public static readonly ID = 'editor.contrib.wordHighlighter';
public static get(editor: ICodeEditor): WordHighlighterContribution {
return editor.getContribution<WordHighlighterContribution>(WordHighlighterContribution.ID);
......@@ -484,10 +484,6 @@ class WordHighlighterContribution extends Disposable implements editorCommon.IEd
createWordHighlighterIfPossible();
}
public getId(): string {
return WordHighlighterContribution.ID;
}
public saveViewState(): boolean {
if (this.wordHighligher && this.wordHighligher.hasDecorations()) {
return true;
......@@ -603,7 +599,7 @@ class TriggerWordHighlightAction extends EditorAction {
}
}
registerEditorContribution(WordHighlighterContribution);
registerEditorContribution(WordHighlighterContribution.ID, WordHighlighterContribution);
registerEditorAction(NextWordHighlightAction);
registerEditorAction(PrevWordHighlightAction);
registerEditorAction(TriggerWordHighlightAction);
......
......@@ -37,7 +37,7 @@ const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey<boolean>('accessi
class AccessibilityHelpController extends Disposable
implements IEditorContribution {
private static readonly ID = 'editor.contrib.accessibilityHelpController';
public static readonly ID = 'editor.contrib.accessibilityHelpController';
public static get(editor: ICodeEditor): AccessibilityHelpController {
return editor.getContribution<AccessibilityHelpController>(
......@@ -60,10 +60,6 @@ class AccessibilityHelpController extends Disposable
);
}
public getId(): string {
return AccessibilityHelpController.ID;
}
public show(): void {
this._widget.show();
}
......@@ -348,7 +344,7 @@ class ShowAccessibilityHelpAction extends EditorAction {
}
}
registerEditorContribution(AccessibilityHelpController);
registerEditorContribution(AccessibilityHelpController.ID, AccessibilityHelpController);
registerEditorAction(ShowAccessibilityHelpAction);
const AccessibilityHelpCommand = EditorCommand.bindToContribution<AccessibilityHelpController>(AccessibilityHelpController.get);
......
......@@ -14,7 +14,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
export class IPadShowKeyboard extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.iPadShowKeyboard';
public static readonly ID = 'editor.contrib.iPadShowKeyboard';
private readonly editor: ICodeEditor;
private widget: ShowKeyboardWidget | null;
......@@ -44,10 +44,6 @@ export class IPadShowKeyboard extends Disposable implements IEditorContribution
}
}
public getId(): string {
return IPadShowKeyboard.ID;
}
public dispose(): void {
super.dispose();
if (this.widget) {
......@@ -103,4 +99,4 @@ class ShowKeyboardWidget extends Disposable implements IOverlayWidget {
}
}
registerEditorContribution(IPadShowKeyboard);
registerEditorContribution(IPadShowKeyboard.ID, IPadShowKeyboard);
......@@ -25,7 +25,7 @@ import { InspectTokensNLS } from 'vs/editor/common/standaloneStrings';
class InspectTokensController extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.inspectTokens';
public static readonly ID = 'editor.contrib.inspectTokens';
public static get(editor: ICodeEditor): InspectTokensController {
return editor.getContribution<InspectTokensController>(InspectTokensController.ID);
......@@ -50,10 +50,6 @@ class InspectTokensController extends Disposable implements IEditorContribution
this._register(TokenizationRegistry.onDidChange((e) => this.stop()));
}
public getId(): string {
return InspectTokensController.ID;
}
public dispose(): void {
this.stop();
super.dispose();
......@@ -325,7 +321,7 @@ class InspectTokensWidget extends Disposable implements IContentWidget {
}
}
registerEditorContribution(InspectTokensController);
registerEditorContribution(InspectTokensController.ID, InspectTokensController);
registerEditorAction(InspectTokens);
registerThemingParticipant((theme, collector) => {
......
......@@ -24,7 +24,7 @@ export interface IQuickOpenControllerOpts {
export class QuickOpenController implements editorCommon.IEditorContribution, IDecorator {
private static readonly ID = 'editor.controller.quickOpenController';
public static readonly ID = 'editor.controller.quickOpenController';
public static get(editor: ICodeEditor): QuickOpenController {
return editor.getContribution<QuickOpenController>(QuickOpenController.ID);
......@@ -39,10 +39,6 @@ export class QuickOpenController implements editorCommon.IEditorContribution, ID
this.editor = editor;
}
public getId(): string {
return QuickOpenController.ID;
}
public dispose(): void {
// Dispose widget
if (this.widget) {
......@@ -173,4 +169,4 @@ export interface IDecorator {
clearDecorations(): void;
}
registerEditorContribution(QuickOpenController);
registerEditorContribution(QuickOpenController.ID, QuickOpenController);
......@@ -37,4 +37,4 @@ export class StandaloneReferencesController extends ReferencesController {
}
}
registerEditorContribution(StandaloneReferencesController);
registerEditorContribution(ReferencesController.ID, StandaloneReferencesController);
......@@ -42,9 +42,9 @@ export class TestCodeEditor extends CodeEditorWidget implements editorBrowser.IC
public getCursor(): Cursor | undefined {
return this._modelData ? this._modelData.cursor : undefined;
}
public registerAndInstantiateContribution<T extends editorCommon.IEditorContribution>(ctor: any): T {
public registerAndInstantiateContribution<T extends editorCommon.IEditorContribution>(id: string, ctor: any): T {
let r = <T>this._instantiationService.createInstance(ctor, this);
this._contributions[r.getId()] = r;
this._contributions[id] = r;
return r;
}
public dispose() {
......
......@@ -2209,10 +2209,6 @@ declare namespace monaco.editor {
* An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed.
*/
export interface IEditorContribution {
/**
* Get a unique identifier for this contribution.
*/
getId(): string;
/**
* Dispose this contribution.
*/
......
......@@ -218,7 +218,7 @@ class SideBySideEditorInputFactory implements IEditorInputFactory {
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(SideBySideEditorInput.ID, SideBySideEditorInputFactory);
// Register Editor Contributions
registerEditorContribution(OpenWorkspaceButtonContribution);
registerEditorContribution(OpenWorkspaceButtonContribution.ID, OpenWorkspaceButtonContribution);
// Register Editor Status
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(EditorStatus, LifecyclePhase.Ready);
......
......@@ -101,7 +101,7 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
return editor.getContribution<OpenWorkspaceButtonContribution>(OpenWorkspaceButtonContribution.ID);
}
private static readonly ID = 'editor.contrib.openWorkspaceButton';
public static readonly ID = 'editor.contrib.openWorkspaceButton';
private openWorkspaceButton: FloatingClickWidget | undefined;
......@@ -122,10 +122,6 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
this._register(this.editor.onDidChangeModel(e => this.update()));
}
getId(): string {
return OpenWorkspaceButtonContribution.ID;
}
private update(): void {
if (!this.shouldShowButton(this.editor)) {
this.disposeOpenWorkspaceWidgetRenderer();
......
......@@ -59,10 +59,6 @@ class CallHierarchyController implements IEditorContribution {
this._dispoables.dispose();
}
getId(): string {
return CallHierarchyController.Id;
}
async startCallHierarchy(): Promise<void> {
this._sessionDisposables.clear();
......@@ -115,7 +111,7 @@ class CallHierarchyController implements IEditorContribution {
}
}
registerEditorContribution(CallHierarchyController);
registerEditorContribution(CallHierarchyController.Id, CallHierarchyController);
registerEditorAction(class extends EditorAction {
......
......@@ -35,7 +35,7 @@ const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey<boolean>('accessi
class AccessibilityHelpController extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.accessibilityHelpController';
public static readonly ID = 'editor.contrib.accessibilityHelpController';
public static get(editor: ICodeEditor): AccessibilityHelpController {
return editor.getContribution<AccessibilityHelpController>(AccessibilityHelpController.ID);
......@@ -54,10 +54,6 @@ class AccessibilityHelpController extends Disposable implements IEditorContribut
this._widget = this._register(instantiationService.createInstance(AccessibilityHelpWidget, this._editor));
}
public getId(): string {
return AccessibilityHelpController.ID;
}
public show(): void {
this._widget.show();
}
......@@ -299,7 +295,7 @@ class ShowAccessibilityHelpAction extends EditorAction {
}
}
registerEditorContribution(AccessibilityHelpController);
registerEditorContribution(AccessibilityHelpController.ID, AccessibilityHelpController);
registerEditorAction(ShowAccessibilityHelpAction);
const AccessibilityHelpCommand = EditorCommand.bindToContribution<AccessibilityHelpController>(AccessibilityHelpController.get);
......
......@@ -6,7 +6,7 @@
import * as nls from 'vs/nls';
import { IDiffEditor } from 'vs/editor/browser/editorBrowser';
import { registerDiffEditorContribution } from 'vs/editor/browser/editorExtensions';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { IDiffEditorContribution } from 'vs/editor/common/editorCommon';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { FloatingClickWidget } from 'vs/workbench/browser/parts/editor/editorWidgets';
import { IDiffComputationResult } from 'vs/editor/common/services/editorWorkerService';
......@@ -19,7 +19,9 @@ const enum WidgetState {
HintWhitespace
}
class DiffEditorHelperContribution extends Disposable implements IEditorContribution {
class DiffEditorHelperContribution extends Disposable implements IDiffEditorContribution {
public static ID = 'editor.contrib.diffEditorHelper';
private _helperWidget: FloatingClickWidget | null;
private _helperWidgetListener: IDisposable | null;
......@@ -99,10 +101,6 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
dispose(): void {
super.dispose();
}
getId(): string {
return 'editor.contrib.diffEditorHelper';
}
}
registerDiffEditorContribution(DiffEditorHelperContribution);
registerDiffEditorContribution(DiffEditorHelperContribution.ID, DiffEditorHelperContribution);
......@@ -27,7 +27,7 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work
class InspectTMScopesController extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.inspectTMScopes';
public static readonly ID = 'editor.contrib.inspectTMScopes';
public static get(editor: ICodeEditor): InspectTMScopesController {
return editor.getContribution<InspectTMScopesController>(InspectTMScopesController.ID);
......@@ -60,10 +60,6 @@ class InspectTMScopesController extends Disposable implements IEditorContributio
this._register(this._editor.onKeyUp((e) => e.keyCode === KeyCode.Escape && this.stop()));
}
public getId(): string {
return InspectTMScopesController.ID;
}
public dispose(): void {
this.stop();
super.dispose();
......@@ -374,7 +370,7 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget {
}
}
registerEditorContribution(InspectTMScopesController);
registerEditorContribution(InspectTMScopesController.ID, InspectTMScopesController);
registerEditorAction(InspectTMScopes);
registerThemingParticipant((theme, collector) => {
......
......@@ -17,7 +17,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
*/
export class LargeFileOptimizationsWarner extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.largeFileOptimizationsWarner';
public static readonly ID = 'editor.contrib.largeFileOptimizationsWarner';
constructor(
private readonly _editor: ICodeEditor,
......@@ -60,10 +60,6 @@ export class LargeFileOptimizationsWarner extends Disposable implements IEditorC
}
}));
}
public getId(): string {
return LargeFileOptimizationsWarner.ID;
}
}
registerEditorContribution(LargeFileOptimizationsWarner);
registerEditorContribution(LargeFileOptimizationsWarner.ID, LargeFileOptimizationsWarner);
......@@ -14,7 +14,7 @@ import { IEditorContribution } from 'vs/editor/common/editorCommon';
*/
export class MenuPreventer extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.menuPreventer';
public static readonly ID = 'editor.contrib.menuPreventer';
private _editor: ICodeEditor;
private _altListeningMouse: boolean;
......@@ -55,10 +55,6 @@ export class MenuPreventer extends Disposable implements IEditorContribution {
}
}));
}
public getId(): string {
return MenuPreventer.ID;
}
}
registerEditorContribution(MenuPreventer);
registerEditorContribution(MenuPreventer.ID, MenuPreventer);
......@@ -17,7 +17,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
export class SelectionClipboard extends Disposable implements IEditorContribution {
private static readonly SELECTION_LENGTH_LIMIT = 65536;
private static readonly ID = 'editor.contrib.selectionClipboard';
public static readonly ID = 'editor.contrib.selectionClipboard';
constructor(editor: ICodeEditor, @IClipboardService clipboardService: IClipboardService) {
super();
......@@ -87,13 +87,9 @@ export class SelectionClipboard extends Disposable implements IEditorContributio
}
}
public getId(): string {
return SelectionClipboard.ID;
}
public dispose(): void {
super.dispose();
}
}
registerEditorContribution(SelectionClipboard);
registerEditorContribution(SelectionClipboard.ID, SelectionClipboard);
......@@ -41,12 +41,12 @@ export function getSimpleCodeEditorWidgetOptions(): ICodeEditorWidgetOptions {
return {
isSimpleWidget: true,
contributions: [
MenuPreventer,
SelectionClipboard,
ContextMenuController,
SuggestController,
SnippetController2,
TabCompletionController,
{ id: MenuPreventer.ID, ctor: MenuPreventer },
{ id: SelectionClipboard.ID, ctor: SelectionClipboard },
{ id: ContextMenuController.ID, ctor: ContextMenuController },
{ id: SuggestController.ID, ctor: SuggestController },
{ id: SnippetController2.ID, ctor: SnippetController2 },
{ id: TabCompletionController.ID, ctor: TabCompletionController },
]
};
}
......@@ -130,7 +130,13 @@ export class SuggestEnabledInput extends Widget implements IThemable {
this.inputWidget = instantiationService.createInstance(CodeEditorWidget, this.stylingContainer,
editorOptions,
{
contributions: [SuggestController, SnippetController2, ContextMenuController, MenuPreventer, SelectionClipboard],
contributions: [
{ id: SuggestController.ID, ctor: SuggestController },
{ id: SnippetController2.ID, ctor: SnippetController2 },
{ id: ContextMenuController.ID, ctor: ContextMenuController },
{ id: MenuPreventer.ID, ctor: MenuPreventer },
{ id: SelectionClipboard.ID, ctor: SelectionClipboard }
],
isSimpleWidget: true,
});
this._register(this.inputWidget);
......
......@@ -166,7 +166,7 @@ class ToggleWordWrapAction extends EditorAction {
class ToggleWordWrapController extends Disposable implements IEditorContribution {
private static readonly _ID = 'editor.contrib.toggleWordWrapController';
public static readonly ID = 'editor.contrib.toggleWordWrapController';
constructor(
private readonly editor: ICodeEditor,
......@@ -254,10 +254,6 @@ class ToggleWordWrapController extends Disposable implements IEditorContribution
wordWrapMinified: state.configuredWordWrapMinified
});
}
public getId(): string {
return ToggleWordWrapController._ID;
}
}
function canToggleWordWrap(uri: URI): boolean {
......@@ -268,7 +264,7 @@ function canToggleWordWrap(uri: URI): boolean {
}
registerEditorContribution(ToggleWordWrapController);
registerEditorContribution(ToggleWordWrapController.ID, ToggleWordWrapController);
registerEditorAction(ToggleWordWrapAction);
......
......@@ -37,4 +37,4 @@ export class WorkbenchReferencesController extends ReferencesController {
}
}
registerEditorContribution(WorkbenchReferencesController);
registerEditorContribution(ReferencesController.ID, WorkbenchReferencesController);
......@@ -314,10 +314,6 @@ export class CommentController implements IEditorContribution {
}
}
public getId(): string {
return ID;
}
public dispose(): void {
this.globalToDispose.dispose();
this.localToDispose.dispose();
......@@ -694,7 +690,7 @@ export class NextCommentThreadAction extends EditorAction {
}
registerEditorContribution(CommentController);
registerEditorContribution(ID, CommentController);
registerEditorAction(NextCommentThreadAction);
CommandsRegistry.registerCommand({
......
......@@ -48,11 +48,11 @@ export class SimpleCommentEditor extends CodeEditorWidget {
) {
const codeEditorWidgetOptions = {
contributions: [
MenuPreventer,
ContextMenuController,
SuggestController,
SnippetController2,
TabCompletionController,
{ id: MenuPreventer.ID, ctor: MenuPreventer },
{ id: ContextMenuController.ID, ctor: ContextMenuController },
{ id: SuggestController.ID, ctor: SuggestController },
{ id: SnippetController2.ID, ctor: SnippetController2 },
{ id: TabCompletionController.ID, ctor: TabCompletionController },
]
};
......
......@@ -145,10 +145,6 @@ class BreakpointEditorContribution implements IBreakpointEditorContribution {
this.setDecorationsScheduler = new RunOnceScheduler(() => this.setDecorations(), 30);
}
getId(): string {
return BREAKPOINT_EDITOR_CONTRIBUTION_ID;
}
private registerListeners(): void {
this.toDispose.push(this.editor.onMouseDown(async (e: IEditorMouseEvent) => {
const data = e.target.detail as IMarginData;
......@@ -587,4 +583,4 @@ class InlineBreakpointWidget implements IContentWidget, IDisposable {
}
}
registerEditorContribution(BreakpointEditorContribution);
registerEditorContribution(BREAKPOINT_EDITOR_CONTRIBUTION_ID, BreakpointEditorContribution);
......@@ -141,10 +141,6 @@ class DebugEditorContribution implements IDebugEditorContribution {
}
}
getId(): string {
return EDITOR_CONTRIBUTION_ID;
}
async showHover(range: Range, focus: boolean): Promise<void> {
const sf = this.debugService.getViewModel().focusedStackFrame;
const model = this.editor.getModel();
......@@ -545,4 +541,4 @@ class DebugEditorContribution implements IDebugEditorContribution {
}
}
registerEditorContribution(DebugEditorContribution);
registerEditorContribution(EDITOR_CONTRIBUTION_ID, DebugEditorContribution);
......@@ -38,7 +38,7 @@ const INTERESTING_FILE = /keybindings\.json$/;
export class DefineKeybindingController extends Disposable implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.contrib.defineKeybinding';
public static readonly ID = 'editor.contrib.defineKeybinding';
static get(editor: ICodeEditor): DefineKeybindingController {
return editor.getContribution<DefineKeybindingController>(DefineKeybindingController.ID);
......@@ -57,10 +57,6 @@ export class DefineKeybindingController extends Disposable implements editorComm
this._update();
}
getId(): string {
return DefineKeybindingController.ID;
}
get keybindingWidgetRenderer(): KeybindingWidgetRenderer | undefined {
return this._keybindingWidgetRenderer;
}
......@@ -385,5 +381,5 @@ function isInterestingEditorModel(editor: ICodeEditor): boolean {
return INTERESTING_FILE.test(url);
}
registerEditorContribution(DefineKeybindingController);
registerEditorContribution(DefineKeybindingController.ID, DefineKeybindingController);
registerEditorCommand(new DefineKeybindingCommand());
......@@ -17,7 +17,7 @@ import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
import * as strings from 'vs/base/common/strings';
import { URI } from 'vs/base/common/uri';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { EditorExtensionsRegistry, IEditorContributionCtor, registerEditorContribution } from 'vs/editor/browser/editorExtensions';
import { EditorExtensionsRegistry, registerEditorContribution, IEditorContributionDescription } from 'vs/editor/browser/editorExtensions';
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import * as editorCommon from 'vs/editor/common/editorCommon';
......@@ -986,10 +986,10 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
super(DefaultPreferencesEditor.ID, telemetryService, instantiationService, storageService, configurationService, themeService, textFileService, editorService, editorGroupService, hostService);
}
private static _getContributions(): IEditorContributionCtor[] {
const skipContributions = [FoldingController.prototype, SelectionHighlighter.prototype, FindController.prototype];
const contributions = EditorExtensionsRegistry.getEditorContributions().filter(c => skipContributions.indexOf(c.prototype) === -1);
contributions.push(DefaultSettingsEditorContribution);
private static _getContributions(): IEditorContributionDescription[] {
const skipContributions = [FoldingController.ID, SelectionHighlighter.ID, FindController.ID];
const contributions = EditorExtensionsRegistry.getEditorContributions().filter(c => skipContributions.indexOf(c.id) === -1);
contributions.push({ id: DefaultSettingsEditorContribution.ID, ctor: DefaultSettingsEditorContribution });
return contributions;
}
......@@ -1158,17 +1158,12 @@ abstract class AbstractSettingsEditorContribution extends Disposable implements
}
protected abstract _createPreferencesRenderer(): Promise<IPreferencesRenderer<ISetting> | null> | null;
abstract getId(): string;
}
export class DefaultSettingsEditorContribution extends AbstractSettingsEditorContribution implements ISettingsEditorContribution {
static readonly ID: string = 'editor.contrib.defaultsettings';
getId(): string {
return DefaultSettingsEditorContribution.ID;
}
protected _createPreferencesRenderer(): Promise<IPreferencesRenderer<ISetting> | null> | null {
return this.preferencesService.createPreferencesEditorModel(this.editor.getModel()!.uri)
.then<any>(editorModel => {
......@@ -1195,10 +1190,6 @@ class SettingsEditorContribution extends AbstractSettingsEditorContribution impl
this._register(this.workspaceContextService.onDidChangeWorkbenchState(() => this._onModelChanged()));
}
getId(): string {
return SettingsEditorContribution.ID;
}
protected _createPreferencesRenderer(): Promise<IPreferencesRenderer<ISetting> | null> | null {
const model = this.editor.getModel();
if (model) {
......@@ -1228,4 +1219,4 @@ class SettingsEditorContribution extends AbstractSettingsEditorContribution impl
}
}
registerEditorContribution(SettingsEditorContribution);
registerEditorContribution(SettingsEditorContribution.ID, SettingsEditorContribution);
......@@ -556,7 +556,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
export class DirtyDiffController extends Disposable implements IEditorContribution {
private static readonly ID = 'editor.contrib.dirtydiff';
public static readonly ID = 'editor.contrib.dirtydiff';
static get(editor: ICodeEditor): DirtyDiffController {
return editor.getContribution<DirtyDiffController>(DirtyDiffController.ID);
......@@ -588,10 +588,6 @@ export class DirtyDiffController extends Disposable implements IEditorContributi
}
}
getId(): string {
return DirtyDiffController.ID;
}
canNavigate(): boolean {
return this.currentIndex === -1 || (!!this.model && this.model.changes.length > 1);
}
......@@ -1319,7 +1315,7 @@ export class DirtyDiffWorkbenchController extends Disposable implements ext.IWor
}
}
registerEditorContribution(DirtyDiffController);
registerEditorContribution(DirtyDiffController.ID, DirtyDiffController);
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const editorGutterModifiedBackgroundColor = theme.getColor(editorGutterModifiedBackground);
......
......@@ -23,7 +23,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
export class TabCompletionController implements editorCommon.IEditorContribution {
private static readonly ID = 'editor.tabCompletionController';
public static readonly ID = 'editor.tabCompletionController';
static readonly ContextKey = new RawContextKey<boolean>('hasSnippetCompletions', undefined);
public static get(editor: ICodeEditor): TabCompletionController {
......@@ -50,10 +50,6 @@ export class TabCompletionController implements editorCommon.IEditorContribution
this._update();
}
getId(): string {
return TabCompletionController.ID;
}
dispose(): void {
dispose(this._configListener);
dispose(this._selectionListener);
......@@ -143,7 +139,7 @@ export class TabCompletionController implements editorCommon.IEditorContribution
}
}
registerEditorContribution(TabCompletionController);
registerEditorContribution(TabCompletionController.ID, TabCompletionController);
const TabCompletionCommand = EditorCommand.bindToContribution<TabCompletionController>(TabCompletionController.get);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册