diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 658c092bf667493442c90368a96229f85de333a5..d1a697bb41daa43ebc355c41c3013622c2f02b8f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -76,8 +76,8 @@ "problemMatcher": [] }, { - "type": "gulp", - "task": "electron", + "type": "npm", + "script": "electron", "label": "Download electron" }, { diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts index d5b881b3af0bca001363702d18bd9fdc78d9a2be..be96d0b9e96498a606b81e50a4e9e248f6af4656 100644 --- a/src/vs/editor/browser/editorExtensions.ts +++ b/src/vs/editor/browser/editorExtensions.ts @@ -25,10 +25,16 @@ import { withNullAsUndefined } from 'vs/base/common/types'; export type ServicesAccessor = InstantiationServicesAccessor; export type IEditorContributionCtor = IConstructorSignature1; export type IDiffEditorContributionCtor = IConstructorSignature1; -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); } diff --git a/src/vs/editor/browser/widget/codeEditorWidget.ts b/src/vs/editor/browser/widget/codeEditorWidget.ts index 503ac32cf272a64639c35df2bcc00effbd55672b..c8b3dffbf447b9393f1a5b957c02ae94d5180720 100644 --- a/src/vs/editor/browser/widget/codeEditorWidget.ts +++ b/src/vs/editor/browser/widget/codeEditorWidget.ts @@ -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); } diff --git a/src/vs/editor/browser/widget/diffEditorWidget.ts b/src/vs/editor/browser/widget/diffEditorWidget.ts index 4bf628a285d8c5bf01272c3f30ca09a46274e96c..e950e51f002b5b8f625c33eacc1222e7f2758a73 100644 --- a/src/vs/editor/browser/widget/diffEditorWidget.ts +++ b/src/vs/editor/browser/widget/diffEditorWidget.ts @@ -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); } diff --git a/src/vs/editor/common/editorCommon.ts b/src/vs/editor/common/editorCommon.ts index 40404a2010650e73555363c2ac9907225db9fe53..1ee594732ff7058b36c9022bc90a11bc974729e7 100644 --- a/src/vs/editor/common/editorCommon.ts +++ b/src/vs/editor/common/editorCommon.ts @@ -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. */ diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts index 44d7bb7613ae18d76dacbf0e94d73f5731292061..9f21abbf9ccfe8108956e42f46360ab50de65eaa 100644 --- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts @@ -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.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) => { diff --git a/src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts b/src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts index f9deb3ce4783f2c4f8dc5aea8d5f6225e9303752..26567b958fed8fd1195fc85e9ec1d17162a75122 100644 --- a/src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts +++ b/src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts @@ -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); + let bracketMatchingController = editor.registerAndInstantiateContribution(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); + let bracketMatchingController = editor.registerAndInstantiateContribution(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); + let bracketMatchingController = editor.registerAndInstantiateContribution(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); + let bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController); // cursors inside brackets become selections of the entire bracket contents editor.setSelections([ diff --git a/src/vs/editor/contrib/codeAction/codeActionCommands.ts b/src/vs/editor/contrib/codeAction/codeActionCommands.ts index 0a516e15d76b704518c1d72610a6ceb168b4f0fb..54c773a6c4b1853a8d649166397f841ef7dcff10 100644 --- a/src/vs/editor/contrib/codeAction/codeActionCommands.ts +++ b/src/vs/editor/contrib/codeAction/codeActionCommands.ts @@ -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.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, diff --git a/src/vs/editor/contrib/codeAction/codeActionContributions.ts b/src/vs/editor/contrib/codeAction/codeActionContributions.ts index 2b9ed4cea8c68169c3de7d6f2fb0cdcdea8474b7..bc25e46078dba4e130cb3dcc67be3ce72e6084c1 100644 --- a/src/vs/editor/contrib/codeAction/codeActionContributions.ts +++ b/src/vs/editor/contrib/codeAction/codeActionContributions.ts @@ -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); diff --git a/src/vs/editor/contrib/codelens/codelensController.ts b/src/vs/editor/contrib/codelens/codelensController.ts index 6e89d47039c142630c0fd40fa25b6cc43c038ca7..a4acfe1ed171a4b42b53d73f472a6f9db9c9075a 100644 --- a/src/vs/editor/contrib/codelens/codelensController.ts +++ b/src/vs/editor/contrib/codelens/codelensController.ts @@ -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); diff --git a/src/vs/editor/contrib/colorPicker/colorDetector.ts b/src/vs/editor/contrib/colorPicker/colorDetector.ts index 7e2b9e03de48a6e3edd98ae462ac4a09ef7168df..9e2113c38d90a5ccec9c4ae69b505e557cf973ab 100644 --- a/src/vs/editor/contrib/colorPicker/colorDetector.ts +++ b/src/vs/editor/contrib/colorPicker/colorDetector.ts @@ -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(this.ID); } @@ -247,4 +243,4 @@ export class ColorDetector extends Disposable implements IEditorContribution { } } -registerEditorContribution(ColorDetector); +registerEditorContribution(ColorDetector.ID, ColorDetector); diff --git a/src/vs/editor/contrib/contextmenu/contextmenu.ts b/src/vs/editor/contrib/contextmenu/contextmenu.ts index e88f633d4cab081f26c4b15aa278c782e8811149..da424f37f45515962d06a315f42c67d218cc3f4b 100644 --- a/src/vs/editor/contrib/contextmenu/contextmenu.ts +++ b/src/vs/editor/contrib/contextmenu/contextmenu.ts @@ -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.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); diff --git a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts index e4568052f6221993928d4c9168c725f4456e36e6..9a5a92888983fd2de80361d0db9c04974479d5ce 100644 --- a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts +++ b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts @@ -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.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); diff --git a/src/vs/editor/contrib/dnd/dnd.ts b/src/vs/editor/contrib/dnd/dnd.ts index 044ea027dc38f91b29527971a405a70de26484fc..f9c0cd00902767e0cbfd6ce4deaa095766d76919 100644 --- a/src/vs/editor/contrib/dnd/dnd.ts +++ b/src/vs/editor/contrib/dnd/dnd.ts @@ -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); diff --git a/src/vs/editor/contrib/find/findController.ts b/src/vs/editor/contrib/find/findController.ts index f5c7305872f3c6f1494bb6a6edb57b4d0e04918d..9ad08a2ca785e34a171a28bb4513c42c1e721c1f 100644 --- a/src/vs/editor/contrib/find/findController.ts +++ b/src/vs/editor/contrib/find/findController.ts @@ -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; @@ -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); diff --git a/src/vs/editor/contrib/find/test/findController.test.ts b/src/vs/editor/contrib/find/test/findController.test.ts index 6ac1767a275da5d6f18c5db6b4d9cb28737fee12..40508db2b30848e5f362a9c6823ec929d4c64f07 100644 --- a/src/vs/editor/contrib/find/test/findController.test.ts +++ b/src/vs/editor/contrib/find/test/findController.test.ts @@ -89,7 +89,7 @@ suite('FindController', () => { assert.ok(true); return; } - let findController = editor.registerAndInstantiateContribution(TestFindController); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController); let findState = findController.getState(); let nextMatchFindAction = new NextMatchFindAction(); @@ -141,7 +141,7 @@ suite('FindController', () => { return; } - let findController = editor.registerAndInstantiateContribution(TestFindController); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(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); + let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController); findController.start({ forceRevealReplace: false, diff --git a/src/vs/editor/contrib/folding/folding.ts b/src/vs/editor/contrib/folding/folding.ts index 87fa92fb8927698757e4024001a1002ee6225588..d000560f648ab419fa85f9c934feba1a74c27ca1 100644 --- a/src/vs/editor/contrib/folding/folding.ts +++ b/src/vs/editor/contrib/folding/folding.ts @@ -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('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(ID); + return editor.getContribution(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 { } } -registerEditorContribution(FoldingController); +registerEditorContribution(FoldingController.ID, FoldingController); registerEditorAction(UnfoldAction); registerEditorAction(UnFoldRecursivelyAction); registerEditorAction(FoldAction); diff --git a/src/vs/editor/contrib/format/formatActions.ts b/src/vs/editor/contrib/format/formatActions.ts index 1af6506e0d87007b8ca9b19665695d9709e328d2..daded6e3e9d183eea5e57389cdc4ac83421f9082 100644 --- a/src/vs/editor/contrib/format/formatActions.ts +++ b/src/vs/editor/contrib/format/formatActions.ts @@ -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); diff --git a/src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts b/src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts index 245c516ff80bc90ac943ae260cab3228e913c396..5dade38c56a3dec718af894c01c7d3b8ba2f977c 100644 --- a/src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts +++ b/src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts @@ -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); diff --git a/src/vs/editor/contrib/gotoError/gotoError.ts b/src/vs/editor/contrib/gotoError/gotoError.ts index 291b30cbb25b1ab46b8092a8292bf5a1a9d08a0e..8e9a86d65a02946eef536818a6288d6858bd3e04 100644 --- a/src/vs/editor/contrib/gotoError/gotoError.ts +++ b/src/vs/editor/contrib/gotoError/gotoError.ts @@ -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.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); diff --git a/src/vs/editor/contrib/hover/hover.ts b/src/vs/editor/contrib/hover/hover.ts index ac7d39b6d94db70712b7e3d1cc556ccc71bf6302..d6a80de294e1c61e577930f970ea605130f23fd3 100644 --- a/src/vs/editor/contrib/hover/hover.ts +++ b/src/vs/editor/contrib/hover/hover.ts @@ -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 diff --git a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts index fce6fc23383fe025ff45c4ec8d6d058a1927341d..70f9fbf73cccdfaab591119cb9c752c70cde249f 100644 --- a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts +++ b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts @@ -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.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 | undefined { // cancel any pending request @@ -183,7 +179,7 @@ class InPlaceReplaceDown extends EditorAction { } } -registerEditorContribution(InPlaceReplaceController); +registerEditorContribution(InPlaceReplaceController.ID, InPlaceReplaceController); registerEditorAction(InPlaceReplaceUp); registerEditorAction(InPlaceReplaceDown); diff --git a/src/vs/editor/contrib/indentation/indentation.ts b/src/vs/editor/contrib/indentation/indentation.ts index 1295fe114febdafaf795a6068b2d7ed4e124a693..bbddafa5346c49961fa2435fc0a96f750c309c58 100644 --- a/src/vs/editor/contrib/indentation/indentation.ts +++ b/src/vs/editor/contrib/indentation/indentation.ts @@ -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); diff --git a/src/vs/editor/contrib/links/links.ts b/src/vs/editor/contrib/links/links.ts index 184fa18ecf0903c3aa6fa0568fbc01423e37c813..2094059be47bce3ed34fdfe8506264d944c09217 100644 --- a/src/vs/editor/contrib/links/links.ts +++ b/src/vs/editor/contrib/links/links.ts @@ -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.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) => { diff --git a/src/vs/editor/contrib/message/messageController.ts b/src/vs/editor/contrib/message/messageController.ts index 311a922e7da5f8884288886c60aae2f3ba285e69..e8214f9a0d923eb051abd5ddad356b3ee653c99b 100644 --- a/src/vs/editor/contrib/message/messageController.ts +++ b/src/vs/editor/contrib/message/messageController.ts @@ -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('messageVisible', false); static get(editor: ICodeEditor): MessageController { - return editor.getContribution(MessageController._id); + return editor.getContribution(MessageController.ID); } private readonly closeTimeout = 3000; // close after 3s - getId(): string { - return MessageController._id; - } - private readonly _editor: ICodeEditor; private readonly _visible: IContextKey; private readonly _messageWidget = this._register(new MutableDisposable()); @@ -184,7 +180,7 @@ class MessageWidget implements IContentWidget { } } -registerEditorContribution(MessageController); +registerEditorContribution(MessageController.ID, MessageController); registerThemingParticipant((theme, collector) => { const border = theme.getColor(inputValidationInfoBorder); diff --git a/src/vs/editor/contrib/multicursor/multicursor.ts b/src/vs/editor/contrib/multicursor/multicursor.ts index 11516c57f83378a23a707d31e8f1c396427d90e8..ae99e18ae824e0a2abc24653cc89e087e6703815 100644 --- a/src/vs/editor/contrib/multicursor/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/multicursor.ts @@ -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); diff --git a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts index ff69c853e8a7f44081f37325d94d2a9ff91cc5ac..7724699ededc99cdc96ef4ccf9a145be0d9060d3 100644 --- a/src/vs/editor/contrib/multicursor/test/multicursor.test.ts +++ b/src/vs/editor/contrib/multicursor/test/multicursor.test.ts @@ -79,8 +79,8 @@ suite('Multicursor selection', () => { 'var z = (3 * 5)', ], { serviceCollection: serviceCollection }, (editor, cursor) => { - let findController = editor.registerAndInstantiateContribution(CommonFindController); - let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController); + let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController); + let multiCursorSelectController = editor.registerAndInstantiateContribution(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); - let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController); + let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController); + let multiCursorSelectController = editor.registerAndInstantiateContribution(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); - let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController); + let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController); + let multiCursorSelectController = editor.registerAndInstantiateContribution(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); - let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController); + let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController); + let multiCursorSelectController = editor.registerAndInstantiateContribution(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); - let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController); + let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController); + let multiCursorSelectController = editor.registerAndInstantiateContribution(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); - let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController); + let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController); + let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController.ID, MultiCursorSelectionController); callback(editor, findController); diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.ts b/src/vs/editor/contrib/parameterHints/parameterHints.ts index 040117092929988e607c6537a1191147723b70a4..6240091c268dddf4023a3be50aac02d9399c819e 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHints.ts @@ -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.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; diff --git a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts index 97d8aa5dbf0237f03397ce8de973ba86b9e6c22c..1906376629b1b3980e313081d51f75e28a489a3c 100644 --- a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts +++ b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts @@ -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); diff --git a/src/vs/editor/contrib/referenceSearch/referencesController.ts b/src/vs/editor/contrib/referenceSearch/referencesController.ts index 6f0dcdff9de8f75613d4c842c58a65635ebb9bdb..61b7d60c7c2ed668f80535297de7ae575d013ff6 100644 --- a/src/vs/editor/contrib/referenceSearch/referencesController.ts +++ b/src/vs/editor/contrib/referenceSearch/referencesController.ts @@ -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); diff --git a/src/vs/editor/contrib/rename/rename.ts b/src/vs/editor/contrib/rename/rename.ts index 796a028890b8fad3e59e3226afba2b54ddfc2e8c..8eb67d9fe04682ee3b452121290ba5daf449e4be 100644 --- a/src/vs/editor/contrib/rename/rename.ts +++ b/src/vs/editor/contrib/rename/rename.ts @@ -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.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.get); diff --git a/src/vs/editor/contrib/smartSelect/smartSelect.ts b/src/vs/editor/contrib/smartSelect/smartSelect.ts index 43401ee00e819c99dfaf340278aaad94a4119170..81b60e73d91c612af85b6f98bdec984fc32682c3 100644 --- a/src/vs/editor/contrib/smartSelect/smartSelect.ts +++ b/src/vs/editor/contrib/smartSelect/smartSelect.ts @@ -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._id); + return editor.getContribution(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 { if (!this._editor.hasModel()) { return; @@ -210,7 +206,7 @@ class ShrinkSelectionAction extends AbstractSmartSelect { } } -registerEditorContribution(SmartSelectController); +registerEditorContribution(SmartSelectController.ID, SmartSelectController); registerEditorAction(GrowSelectionAction); registerEditorAction(ShrinkSelectionAction); diff --git a/src/vs/editor/contrib/snippet/snippetController2.ts b/src/vs/editor/contrib/snippet/snippetController2.ts index 021310ed8396de1fced6a22f59d342d6563b236c..322b36075cab05bfa909cf24c72a00c909f659ca 100644 --- a/src/vs/editor/contrib/snippet/snippetController2.ts +++ b/src/vs/editor/contrib/snippet/snippetController2.ts @@ -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'); + return editor.getContribution(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 @@ -249,7 +247,7 @@ export class SnippetController2 implements IEditorContribution { } -registerEditorContribution(SnippetController2); +registerEditorContribution(SnippetController2.ID, SnippetController2); const CommandCtor = EditorCommand.bindToContribution(SnippetController2.get); diff --git a/src/vs/editor/contrib/snippet/test/snippetController2.old.test.ts b/src/vs/editor/contrib/snippet/test/snippetController2.old.test.ts index c9751d0504d3706e616b8f7b1d95d337891dd8de..05db9b1f12b23c9e1fa8e46ef544259fd013a4a1 100644 --- a/src/vs/editor/contrib/snippet/test/snippetController2.old.test.ts +++ b/src/vs/editor/contrib/snippet/test/snippetController2.old.test.ts @@ -45,7 +45,7 @@ suite('SnippetController', () => { editor.getModel()!.updateOptions({ insertSpaces: false }); - let snippetController = editor.registerAndInstantiateContribution(TestSnippetController); + let snippetController = editor.registerAndInstantiateContribution(TestSnippetController.ID, TestSnippetController); let template = [ 'for (var ${1:index}; $1 < ${2:array}.length; $1++) {', '\tvar element = $2[$1];', diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts index 1ae5015e0157c51cad6a3ce820c491a7a18b736c..84badeb56c0306b1071d5059b717e0cdebc0ad60 100644 --- a/src/vs/editor/contrib/suggest/suggestController.ts +++ b/src/vs/editor/contrib/suggest/suggestController.ts @@ -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.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; diff --git a/src/vs/editor/contrib/suggest/test/suggestModel.test.ts b/src/vs/editor/contrib/suggest/test/suggestModel.test.ts index 88448ea0db71565793555b630d7849ae9dbd8f73..adc0d0372d48ac3b01270c93267ac6cb9b504fa0 100644 --- a/src/vs/editor/contrib/suggest/test/suggestModel.test.ts +++ b/src/vs/editor/contrib/suggest/test/suggestModel.test.ts @@ -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 = editor.registerAndInstantiateContribution(TestCtrl); - editor.registerAndInstantiateContribution(SnippetController2); + const ctrl = editor.registerAndInstantiateContribution(TestCtrl.ID, TestCtrl); + editor.registerAndInstantiateContribution(SnippetController2.ID, SnippetController2); await assertEvent(sugget.onDidSuggest, () => { editor.setPosition({ lineNumber: 1, column: 3 }); diff --git a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts index 2ca31521aff783c2e93aee24af5296ab28ba3c10..d3bc5b4e2672ce5a464a3bceff67d8edda804921 100644 --- a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts +++ b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts @@ -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.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); diff --git a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts index 8b4337e04911d595c39732c1c5668222d2f1ec34..ade5fe6494cf08acade2ac5026df6963e88270c7 100644 --- a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts +++ b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts @@ -37,7 +37,7 @@ const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey('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( @@ -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.get); diff --git a/src/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.ts b/src/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.ts index 82ccd6a63f74a9a3600f01893501d77447801ca9..e67d6364b57b17f48db68f6ae763fc1e34d3b50e 100644 --- a/src/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.ts +++ b/src/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.ts @@ -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); diff --git a/src/vs/editor/standalone/browser/inspectTokens/inspectTokens.ts b/src/vs/editor/standalone/browser/inspectTokens/inspectTokens.ts index 47a2da412ef4af3a9ec13cecc838de4b97f66b01..7ca77cdff869d3599825d03ffa6d9c0e774b0818 100644 --- a/src/vs/editor/standalone/browser/inspectTokens/inspectTokens.ts +++ b/src/vs/editor/standalone/browser/inspectTokens/inspectTokens.ts @@ -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.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) => { diff --git a/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts b/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts index 96bcc2ea3c4ef772fcffc795a709ab856be5af0e..bee2ce31a268dd1933ab1ec2b5d21a2fe1e74b5b 100644 --- a/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts +++ b/src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts @@ -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.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); diff --git a/src/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.ts b/src/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.ts index 3dcbb43537c0d6b06a81a1b962a93fd3ae8fb654..0739802fb782fb056afd25dcb1b2bdac2a475074 100644 --- a/src/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.ts +++ b/src/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.ts @@ -37,4 +37,4 @@ export class StandaloneReferencesController extends ReferencesController { } } -registerEditorContribution(StandaloneReferencesController); +registerEditorContribution(ReferencesController.ID, StandaloneReferencesController); diff --git a/src/vs/editor/test/browser/testCodeEditor.ts b/src/vs/editor/test/browser/testCodeEditor.ts index 0eff406dafa971e30200848466f5943d49960416..c4eb0282b2cd091f55fde4a507d52a6821e25172 100644 --- a/src/vs/editor/test/browser/testCodeEditor.ts +++ b/src/vs/editor/test/browser/testCodeEditor.ts @@ -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(ctor: any): T { + public registerAndInstantiateContribution(id: string, ctor: any): T { let r = this._instantiationService.createInstance(ctor, this); - this._contributions[r.getId()] = r; + this._contributions[id] = r; return r; } public dispose() { diff --git a/src/vs/monaco.d.ts b/src/vs/monaco.d.ts index 0e46af07f9a7f40ca5468a29b60ce66facbb0e2e..da138f80abf99f19b74614360920c3db3091b33f 100644 --- a/src/vs/monaco.d.ts +++ b/src/vs/monaco.d.ts @@ -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. */ diff --git a/src/vs/workbench/browser/parts/editor/editor.contribution.ts b/src/vs/workbench/browser/parts/editor/editor.contribution.ts index 1329bd6a7914f09f6cead9c1168c9b6bb41d2804..c2b57f0ec25f9eef1aeb4976ed7e5bbe1c3fb5d2 100644 --- a/src/vs/workbench/browser/parts/editor/editor.contribution.ts +++ b/src/vs/workbench/browser/parts/editor/editor.contribution.ts @@ -218,7 +218,7 @@ class SideBySideEditorInputFactory implements IEditorInputFactory { Registry.as(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(SideBySideEditorInput.ID, SideBySideEditorInputFactory); // Register Editor Contributions -registerEditorContribution(OpenWorkspaceButtonContribution); +registerEditorContribution(OpenWorkspaceButtonContribution.ID, OpenWorkspaceButtonContribution); // Register Editor Status Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(EditorStatus, LifecyclePhase.Ready); diff --git a/src/vs/workbench/browser/parts/editor/editorWidgets.ts b/src/vs/workbench/browser/parts/editor/editorWidgets.ts index 22ca587814e910cd801f2bf0d6c26b4d04ca3783..53652291b68d4ec5c9b7ad642ad2cc08e41fa715 100644 --- a/src/vs/workbench/browser/parts/editor/editorWidgets.ts +++ b/src/vs/workbench/browser/parts/editor/editorWidgets.ts @@ -101,7 +101,7 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit return editor.getContribution(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(); diff --git a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts index d17090d01a332c5838f283406de5d2df1a61fc37..f9dd68e6b3c32ad72d2b0bcd9e0ce0ece58228e8 100644 --- a/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts +++ b/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts @@ -59,10 +59,6 @@ class CallHierarchyController implements IEditorContribution { this._dispoables.dispose(); } - getId(): string { - return CallHierarchyController.Id; - } - async startCallHierarchy(): Promise { this._sessionDisposables.clear(); @@ -115,7 +111,7 @@ class CallHierarchyController implements IEditorContribution { } } -registerEditorContribution(CallHierarchyController); +registerEditorContribution(CallHierarchyController.Id, CallHierarchyController); registerEditorAction(class extends EditorAction { diff --git a/src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.ts b/src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.ts index 4e2253b87319869faaf9e3c21eeb376d9ac1e712..458de2f3c230dee64d1067de171a98a41b61bb2d 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.ts @@ -35,7 +35,7 @@ const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey('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.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.get); diff --git a/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.ts b/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.ts index 878fba9d4572d89fa7b53f20a64e134d7aaf5e34..d01c06d5e59b6586db733f015436b9d35827e1a2 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.ts @@ -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); diff --git a/src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts b/src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts index c01b75c3cbbe6aff6e893a0107ad0db7913ceffc..aecdba4bd23b855cd2817644629bf0bd5414829c 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts @@ -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.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) => { diff --git a/src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.ts b/src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.ts index 551c3e4b86a3659f3d2a647ae1eece57bdcd5b98..2febc613bf7bd1b95db621935b706cfca0ba8ef6 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.ts @@ -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); diff --git a/src/vs/workbench/contrib/codeEditor/browser/menuPreventer.ts b/src/vs/workbench/contrib/codeEditor/browser/menuPreventer.ts index 7d5845d3519c276a86852a7efdd5818a3d8121b9..4e62cd2f4c093c48d6832174c064ae86f7f359a0 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/menuPreventer.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/menuPreventer.ts @@ -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); diff --git a/src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts b/src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts index 5d7a143aa981932f80130cb2d845252d4fc1a315..60b060bf4237ca9854c07f70d32efb6388e236df 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts @@ -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); diff --git a/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts b/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts index 6b256e04a8c8c4ac3fd2ba33734880d722b6bc84..447f9ce32a8e868ab73dbc323e9fb65dbc1932c9 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts @@ -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 }, ] }; } diff --git a/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts b/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts index 924ad443981db6ebcbd04eb38ad27f415663bb1e..5b9f2ed9c98229130b1102bc904e743a21e29bf4 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts @@ -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); diff --git a/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.ts b/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.ts index f5abc1078ce5b9c9c05a676514a81b853ae4a3f5..29f6839f84b81a88656558c13565ad18d341c881 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.ts @@ -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); diff --git a/src/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.ts b/src/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.ts index 6e3236ffa276dccc4d74f2464a5e8d20a9a95fff..a38a3245b039ffbe0ab6a61a4ce9b997f1c464ac 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.ts @@ -37,4 +37,4 @@ export class WorkbenchReferencesController extends ReferencesController { } } -registerEditorContribution(WorkbenchReferencesController); +registerEditorContribution(ReferencesController.ID, WorkbenchReferencesController); diff --git a/src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts b/src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts index 0f05fcc8d1d280bd9adb4326577d4971d9b9d09e..6bd03c670c10a62c9328ecdb87c994d3227fca48 100644 --- a/src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts +++ b/src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts @@ -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({ diff --git a/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts b/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts index 12a7897fec694907da8cfcc1fb9d5f58a06fbbbb..3a1c3f5a66311c6419eb26d741fc5cc8af04a067 100644 --- a/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts +++ b/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts @@ -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 }, ] }; diff --git a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts index 936e2ca8cf13136cb7f99c8c0590672f50c6b6f5..f2c3183f2222fff757a7b21a0d0ea8a395d7f151 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts @@ -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); diff --git a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts index cb038aac947950d251798a13c942793a3bbdd939..28fad67b4396a18d523fc0dc14f08ceade75ce8f 100644 --- a/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts @@ -141,10 +141,6 @@ class DebugEditorContribution implements IDebugEditorContribution { } } - getId(): string { - return EDITOR_CONTRIBUTION_ID; - } - async showHover(range: Range, focus: boolean): Promise { 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); diff --git a/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts b/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts index 006e90f2a762dc1d99ab75950de3097474d0bddd..6375de9ffda08063501d611e34e97cd848cb39d7 100644 --- a/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts +++ b/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts @@ -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.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()); diff --git a/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts b/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts index 2c8cfd128204324dcf262ae64674eeb787b20d75..2a58bc3595280ee8e3fd53ec40757b49f344936c 100644 --- a/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts +++ b/src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts @@ -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 | 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 | null> | null { return this.preferencesService.createPreferencesEditorModel(this.editor.getModel()!.uri) .then(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 | null> | null { const model = this.editor.getModel(); if (model) { @@ -1228,4 +1219,4 @@ class SettingsEditorContribution extends AbstractSettingsEditorContribution impl } } -registerEditorContribution(SettingsEditorContribution); +registerEditorContribution(SettingsEditorContribution.ID, SettingsEditorContribution); diff --git a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts index 7bfc519deb41ede37471e61379d1997009a782e7..585097e6b616a689d5e7940ccd397865a9d698f8 100644 --- a/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts @@ -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.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); diff --git a/src/vs/workbench/contrib/snippets/browser/tabCompletion.ts b/src/vs/workbench/contrib/snippets/browser/tabCompletion.ts index 9522f3006b15502d3927da9ca10bf76b8ee003f9..4f54adf23018d806176b6af7f5a90071c14f86ae 100644 --- a/src/vs/workbench/contrib/snippets/browser/tabCompletion.ts +++ b/src/vs/workbench/contrib/snippets/browser/tabCompletion.ts @@ -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('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.get);