Skip to content

Commit 24a5df3

Browse files
committed
Type registerAndInstantiateContribution
Type out the ctor argument type. This also removes the need to explicitly type the return type
1 parent 1b78eec commit 24a5df3

5 files changed

Lines changed: 43 additions & 42 deletions

File tree

src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ suite('bracket matching', () => {
3434
let model = createTextModel('var x = (3 + (5-7)) + ((5+3)+5);', undefined, mode.getLanguageIdentifier());
3535

3636
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
37-
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
37+
let bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController);
3838

3939
// start on closing bracket
4040
editor.setPosition(new Position(1, 20));
@@ -66,7 +66,7 @@ suite('bracket matching', () => {
6666
let model = createTextModel('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier());
6767

6868
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
69-
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
69+
let bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController);
7070

7171
// start position between brackets
7272
editor.setPosition(new Position(1, 16));
@@ -103,7 +103,7 @@ suite('bracket matching', () => {
103103
let model = createTextModel('var x = (3 + (5-7)); y();', undefined, mode.getLanguageIdentifier());
104104

105105
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
106-
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
106+
let bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController);
107107

108108

109109
// start position in open brackets
@@ -155,7 +155,7 @@ suite('bracket matching', () => {
155155
const model = createTextModel(text, undefined, mode.getLanguageIdentifier());
156156

157157
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
158-
const bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
158+
const bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController);
159159

160160
editor.setPosition(new Position(3, 5));
161161
bracketMatchingController.jumpToBracket();
@@ -180,7 +180,7 @@ suite('bracket matching', () => {
180180
const model = createTextModel(text, undefined, mode.getLanguageIdentifier());
181181

182182
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
183-
const bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
183+
const bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController);
184184

185185
editor.setPosition(new Position(3, 5));
186186
bracketMatchingController.selectToBracket(false);
@@ -198,7 +198,7 @@ suite('bracket matching', () => {
198198
let model = createTextModel('{ } { } { }', undefined, mode.getLanguageIdentifier());
199199

200200
withTestCodeEditor(null, { model: model }, (editor, cursor) => {
201-
let bracketMatchingController = editor.registerAndInstantiateContribution<BracketMatchingController>(BracketMatchingController.ID, BracketMatchingController);
201+
let bracketMatchingController = editor.registerAndInstantiateContribution(BracketMatchingController.ID, BracketMatchingController);
202202

203203
// cursors inside brackets become selections of the entire bracket contents
204204
editor.setSelections([

src/vs/editor/contrib/find/test/findController.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ suite('FindController', () => {
8989
assert.ok(true);
9090
return;
9191
}
92-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
92+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
9393
let startFindAction = new StartFindAction();
9494
// I select ABC on the first line
9595
editor.setSelection(new Selection(1, 1, 1, 4));
@@ -115,7 +115,7 @@ suite('FindController', () => {
115115
return;
116116
}
117117
118-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
118+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
119119
let findState = findController.getState();
120120
let nextMatchFindAction = new NextMatchFindAction();
121121
@@ -141,7 +141,7 @@ suite('FindController', () => {
141141
return;
142142
}
143143
144-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
144+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
145145
let findState = findController.getState();
146146
147147
findState.change({ searchString: 'ABC' }, true);
@@ -161,7 +161,7 @@ suite('FindController', () => {
161161
], { serviceCollection: serviceCollection }, (editor, cursor) => {
162162
clipboardState = '';
163163
// The cursor is at the very top, of the file, at the first ABC
164-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
164+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
165165
let findState = findController.getState();
166166
let startFindAction = new StartFindAction();
167167
let nextMatchFindAction = new NextMatchFindAction();
@@ -215,7 +215,7 @@ suite('FindController', () => {
215215
'import nls = require(\'vs/nls\');'
216216
], { serviceCollection: serviceCollection }, (editor, cursor) => {
217217
clipboardState = '';
218-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
218+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
219219
let nextMatchFindAction = new NextMatchFindAction();
220220

221221
editor.setPosition({
@@ -240,7 +240,7 @@ suite('FindController', () => {
240240
'var z = (3 * 5)',
241241
], { serviceCollection: serviceCollection }, (editor, cursor) => {
242242
clipboardState = '';
243-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
243+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
244244
let startFindAction = new StartFindAction();
245245
let nextMatchFindAction = new NextMatchFindAction();
246246

@@ -264,7 +264,7 @@ suite('FindController', () => {
264264
'test',
265265
], { serviceCollection: serviceCollection }, (editor, cursor) => {
266266
let testRegexString = 'tes.';
267-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
267+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
268268
let nextMatchFindAction = new NextMatchFindAction();
269269
let startFindReplaceAction = new StartFindReplaceAction();
270270

@@ -294,7 +294,7 @@ suite('FindController', () => {
294294
'var z = (3 * 5)',
295295
], { serviceCollection: serviceCollection }, (editor, cursor) => {
296296
clipboardState = '';
297-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
297+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
298298
findController.start({
299299
forceRevealReplace: false,
300300
seedSearchStringFromSelection: false,
@@ -322,7 +322,7 @@ suite('FindController', () => {
322322
'HRESULT OnAmbientPropertyChange(DISPID dispid);'
323323
], { serviceCollection: serviceCollection }, (editor, cursor) => {
324324
clipboardState = '';
325-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
325+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
326326

327327
let startFindAction = new StartFindAction();
328328
startFindAction.run(null, editor);
@@ -349,7 +349,7 @@ suite('FindController', () => {
349349
'line3'
350350
], { serviceCollection: serviceCollection }, (editor, cursor) => {
351351
clipboardState = '';
352-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
352+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
353353

354354
let startFindAction = new StartFindAction();
355355
startFindAction.run(null, editor);
@@ -376,7 +376,7 @@ suite('FindController', () => {
376376
'([funny]'
377377
], { serviceCollection: serviceCollection }, (editor, cursor) => {
378378
clipboardState = '';
379-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
379+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
380380
let nextSelectionMatchFindAction = new NextSelectionMatchFindAction();
381381

382382
// toggle regex
@@ -403,7 +403,7 @@ suite('FindController', () => {
403403
'([funny]'
404404
], { serviceCollection: serviceCollection }, (editor, cursor) => {
405405
clipboardState = '';
406-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
406+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
407407
let startFindAction = new StartFindAction();
408408
let nextSelectionMatchFindAction = new NextSelectionMatchFindAction();
409409

@@ -454,7 +454,7 @@ suite('FindController query options persistence', () => {
454454
], { serviceCollection: serviceCollection }, (editor, cursor) => {
455455
queryState = { 'editor.isRegex': false, 'editor.matchCase': true, 'editor.wholeWord': false };
456456
// The cursor is at the very top, of the file, at the first ABC
457-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
457+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
458458
let findState = findController.getState();
459459
let startFindAction = new StartFindAction();
460460

@@ -481,7 +481,7 @@ suite('FindController query options persistence', () => {
481481
], { serviceCollection: serviceCollection }, (editor, cursor) => {
482482
queryState = { 'editor.isRegex': false, 'editor.matchCase': false, 'editor.wholeWord': true };
483483
// The cursor is at the very top, of the file, at the first ABC
484-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
484+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
485485
let findState = findController.getState();
486486
let startFindAction = new StartFindAction();
487487

@@ -506,7 +506,7 @@ suite('FindController query options persistence', () => {
506506
], { serviceCollection: serviceCollection }, (editor, cursor) => {
507507
queryState = { 'editor.isRegex': false, 'editor.matchCase': false, 'editor.wholeWord': true };
508508
// The cursor is at the very top, of the file, at the first ABC
509-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
509+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
510510
findController.toggleRegex();
511511
assert.equal(queryState['editor.isRegex'], true);
512512

@@ -522,7 +522,7 @@ suite('FindController query options persistence', () => {
522522
], { serviceCollection: serviceCollection, find: { autoFindInSelection: 'always', globalFindClipboard: false } }, (editor, cursor) => {
523523
// clipboardState = '';
524524
editor.setSelection(new Range(1, 1, 2, 1));
525-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
525+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
526526

527527
findController.start({
528528
forceRevealReplace: false,
@@ -545,7 +545,7 @@ suite('FindController query options persistence', () => {
545545
], { serviceCollection: serviceCollection, find: { autoFindInSelection: 'always', globalFindClipboard: false } }, (editor, cursor) => {
546546
// clipboardState = '';
547547
editor.setSelection(new Range(1, 2, 1, 2));
548-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
548+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
549549

550550
findController.start({
551551
forceRevealReplace: false,
@@ -568,7 +568,7 @@ suite('FindController query options persistence', () => {
568568
], { serviceCollection: serviceCollection, find: { autoFindInSelection: 'always', globalFindClipboard: false } }, (editor, cursor) => {
569569
// clipboardState = '';
570570
editor.setSelection(new Range(1, 2, 1, 3));
571-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
571+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
572572

573573
findController.start({
574574
forceRevealReplace: false,
@@ -592,7 +592,7 @@ suite('FindController query options persistence', () => {
592592
], { serviceCollection: serviceCollection, find: { autoFindInSelection: 'multiline', globalFindClipboard: false } }, (editor, cursor) => {
593593
// clipboardState = '';
594594
editor.setSelection(new Range(1, 6, 2, 1));
595-
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
595+
let findController = editor.registerAndInstantiateContribution(TestFindController.ID, TestFindController);
596596

597597
findController.start({
598598
forceRevealReplace: false,

src/vs/editor/contrib/multicursor/test/multicursor.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ suite('Multicursor selection', () => {
8080
'var z = (3 * 5)',
8181
], { serviceCollection: serviceCollection }, (editor, cursor) => {
8282

83-
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
84-
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
83+
let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController);
84+
let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController.ID, MultiCursorSelectionController);
8585
let selectHighlightsAction = new SelectHighlightsAction();
8686

8787
editor.setSelection(new Selection(2, 9, 2, 16));
@@ -110,8 +110,8 @@ suite('Multicursor selection', () => {
110110
'nothing'
111111
], { serviceCollection: serviceCollection }, (editor, cursor) => {
112112

113-
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
114-
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
113+
let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController);
114+
let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController.ID, MultiCursorSelectionController);
115115
let selectHighlightsAction = new SelectHighlightsAction();
116116

117117
editor.setSelection(new Selection(1, 1, 1, 1));
@@ -144,8 +144,8 @@ suite('Multicursor selection', () => {
144144
'rty'
145145
], { serviceCollection: serviceCollection }, (editor, cursor) => {
146146

147-
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
148-
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
147+
let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController);
148+
let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController.ID, MultiCursorSelectionController);
149149
let addSelectionToNextFindMatch = new AddSelectionToNextFindMatchAction();
150150

151151
editor.setSelection(new Selection(2, 1, 3, 4));
@@ -172,8 +172,8 @@ suite('Multicursor selection', () => {
172172
'abcabc',
173173
], { serviceCollection: serviceCollection }, (editor, cursor) => {
174174

175-
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
176-
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
175+
let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController);
176+
let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController.ID, MultiCursorSelectionController);
177177
let addSelectionToNextFindMatch = new AddSelectionToNextFindMatchAction();
178178

179179
editor.setSelection(new Selection(1, 1, 1, 4));
@@ -229,8 +229,8 @@ suite('Multicursor selection', () => {
229229

230230
editor.getModel()!.setEOL(EndOfLineSequence.CRLF);
231231

232-
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
233-
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
232+
let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController);
233+
let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController.ID, MultiCursorSelectionController);
234234
let addSelectionToNextFindMatch = new AddSelectionToNextFindMatchAction();
235235

236236
editor.setSelection(new Selection(2, 1, 3, 4));
@@ -252,8 +252,8 @@ suite('Multicursor selection', () => {
252252

253253
function testMulticursor(text: string[], callback: (editor: TestCodeEditor, findController: CommonFindController) => void): void {
254254
withTestCodeEditor(text, { serviceCollection: serviceCollection }, (editor, cursor) => {
255-
let findController = editor.registerAndInstantiateContribution<CommonFindController>(CommonFindController.ID, CommonFindController);
256-
let multiCursorSelectController = editor.registerAndInstantiateContribution<MultiCursorSelectionController>(MultiCursorSelectionController.ID, MultiCursorSelectionController);
255+
let findController = editor.registerAndInstantiateContribution(CommonFindController.ID, CommonFindController);
256+
let multiCursorSelectController = editor.registerAndInstantiateContribution(MultiCursorSelectionController.ID, MultiCursorSelectionController);
257257

258258
callback(editor, findController);
259259

src/vs/editor/contrib/snippet/test/snippetController2.old.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ suite('SnippetController', () => {
4545
editor.getModel()!.updateOptions({
4646
insertSpaces: false
4747
});
48-
let snippetController = editor.registerAndInstantiateContribution<TestSnippetController>(TestSnippetController.ID, TestSnippetController);
48+
let snippetController = editor.registerAndInstantiateContribution(TestSnippetController.ID, TestSnippetController);
4949
let template = [
5050
'for (var ${1:index}; $1 < ${2:array}.length; $1++) {',
5151
'\tvar element = $2[$1];',

0 commit comments

Comments
 (0)