mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-30 00:30:29 -04:00
Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 (#7880)
* Merge from vscode c58aaab8a1cc22a7139b761166a0d4f37d41e998 * fix pipelines * fix strict-null-checks * add missing files
This commit is contained in:
@@ -70,7 +70,7 @@ export interface IFindStartOptions {
|
||||
|
||||
export class CommonFindController extends Disposable implements editorCommon.IEditorContribution {
|
||||
|
||||
private static readonly ID = 'editor.contrib.findController';
|
||||
public static readonly ID = 'editor.contrib.findController';
|
||||
|
||||
protected _editor: ICodeEditor;
|
||||
private readonly _findWidgetVisible: IContextKey<boolean>;
|
||||
@@ -143,10 +143,6 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
|
||||
}
|
||||
}
|
||||
|
||||
public getId(): string {
|
||||
return CommonFindController.ID;
|
||||
}
|
||||
|
||||
private _onStateChanged(e: FindReplaceStateChangedEvent): void {
|
||||
this.saveQueryState(e);
|
||||
|
||||
@@ -735,7 +731,7 @@ export class StartFindReplaceAction extends EditorAction {
|
||||
}
|
||||
}
|
||||
|
||||
registerEditorContribution(FindController);
|
||||
registerEditorContribution(CommonFindController.ID, FindController);
|
||||
|
||||
registerEditorAction(StartFindAction);
|
||||
registerEditorAction(StartFindWithSelectionAction);
|
||||
|
||||
@@ -12,7 +12,7 @@ import { CursorChangeReason, ICursorPositionChangedEvent } from 'vs/editor/commo
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { Selection } from 'vs/editor/common/core/selection';
|
||||
import { Constants } from 'vs/editor/common/core/uint';
|
||||
import { Constants } from 'vs/base/common/uint';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
import { EndOfLinePreference, FindMatch, ITextModel } from 'vs/editor/common/model';
|
||||
import { SearchParams } from 'vs/editor/common/model/textModelSearch';
|
||||
|
||||
@@ -89,7 +89,7 @@ suite('FindController', () => {
|
||||
assert.ok(true);
|
||||
return;
|
||||
}
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let startFindAction = new StartFindAction();
|
||||
// I select ABC on the first line
|
||||
editor.setSelection(new Selection(1, 1, 1, 4));
|
||||
@@ -115,7 +115,7 @@ suite('FindController', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let findState = findController.getState();
|
||||
let nextMatchFindAction = new NextMatchFindAction();
|
||||
|
||||
@@ -141,7 +141,7 @@ suite('FindController', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let findState = findController.getState();
|
||||
|
||||
findState.change({ searchString: 'ABC' }, true);
|
||||
@@ -161,7 +161,7 @@ suite('FindController', () => {
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
clipboardState = '';
|
||||
// The cursor is at the very top, of the file, at the first ABC
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let findState = findController.getState();
|
||||
let startFindAction = new StartFindAction();
|
||||
let nextMatchFindAction = new NextMatchFindAction();
|
||||
@@ -215,7 +215,7 @@ suite('FindController', () => {
|
||||
'import nls = require(\'vs/nls\');'
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
clipboardState = '';
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let nextMatchFindAction = new NextMatchFindAction();
|
||||
|
||||
editor.setPosition({
|
||||
@@ -240,7 +240,7 @@ suite('FindController', () => {
|
||||
'var z = (3 * 5)',
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
clipboardState = '';
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let startFindAction = new StartFindAction();
|
||||
let nextMatchFindAction = new NextMatchFindAction();
|
||||
|
||||
@@ -264,7 +264,7 @@ suite('FindController', () => {
|
||||
'test',
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
let testRegexString = 'tes.';
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let nextMatchFindAction = new NextMatchFindAction();
|
||||
let startFindReplaceAction = new StartFindReplaceAction();
|
||||
|
||||
@@ -294,7 +294,7 @@ suite('FindController', () => {
|
||||
'var z = (3 * 5)',
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
clipboardState = '';
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
findController.start({
|
||||
forceRevealReplace: false,
|
||||
seedSearchStringFromSelection: false,
|
||||
@@ -322,7 +322,7 @@ suite('FindController', () => {
|
||||
'HRESULT OnAmbientPropertyChange(DISPID dispid);'
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
clipboardState = '';
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
|
||||
let startFindAction = new StartFindAction();
|
||||
startFindAction.run(null, editor);
|
||||
@@ -349,7 +349,7 @@ suite('FindController', () => {
|
||||
'line3'
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
clipboardState = '';
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
|
||||
let startFindAction = new StartFindAction();
|
||||
startFindAction.run(null, editor);
|
||||
@@ -376,7 +376,7 @@ suite('FindController', () => {
|
||||
'([funny]'
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
clipboardState = '';
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let nextSelectionMatchFindAction = new NextSelectionMatchFindAction();
|
||||
|
||||
// toggle regex
|
||||
@@ -403,7 +403,7 @@ suite('FindController', () => {
|
||||
'([funny]'
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
clipboardState = '';
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let startFindAction = new StartFindAction();
|
||||
let nextSelectionMatchFindAction = new NextSelectionMatchFindAction();
|
||||
|
||||
@@ -454,7 +454,7 @@ suite('FindController query options persistence', () => {
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
queryState = { 'editor.isRegex': false, 'editor.matchCase': true, 'editor.wholeWord': false };
|
||||
// The cursor is at the very top, of the file, at the first ABC
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let findState = findController.getState();
|
||||
let startFindAction = new StartFindAction();
|
||||
|
||||
@@ -481,7 +481,7 @@ suite('FindController query options persistence', () => {
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
queryState = { 'editor.isRegex': false, 'editor.matchCase': false, 'editor.wholeWord': true };
|
||||
// The cursor is at the very top, of the file, at the first ABC
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
let findState = findController.getState();
|
||||
let startFindAction = new StartFindAction();
|
||||
|
||||
@@ -506,7 +506,7 @@ suite('FindController query options persistence', () => {
|
||||
], { serviceCollection: serviceCollection }, (editor, cursor) => {
|
||||
queryState = { 'editor.isRegex': false, 'editor.matchCase': false, 'editor.wholeWord': true };
|
||||
// The cursor is at the very top, of the file, at the first ABC
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
findController.toggleRegex();
|
||||
assert.equal(queryState['editor.isRegex'], true);
|
||||
|
||||
@@ -522,7 +522,7 @@ suite('FindController query options persistence', () => {
|
||||
], { serviceCollection: serviceCollection, find: { autoFindInSelection: true, globalFindClipboard: false } }, (editor, cursor) => {
|
||||
// clipboardState = '';
|
||||
editor.setSelection(new Range(1, 1, 2, 1));
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
|
||||
findController.start({
|
||||
forceRevealReplace: false,
|
||||
@@ -545,7 +545,7 @@ suite('FindController query options persistence', () => {
|
||||
], { serviceCollection: serviceCollection, find: { autoFindInSelection: true, globalFindClipboard: false } }, (editor, cursor) => {
|
||||
// clipboardState = '';
|
||||
editor.setSelection(new Range(1, 2, 1, 2));
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
|
||||
findController.start({
|
||||
forceRevealReplace: false,
|
||||
@@ -568,7 +568,7 @@ suite('FindController query options persistence', () => {
|
||||
], { serviceCollection: serviceCollection, find: { autoFindInSelection: true, globalFindClipboard: false } }, (editor, cursor) => {
|
||||
// clipboardState = '';
|
||||
editor.setSelection(new Range(1, 2, 1, 3));
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
|
||||
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController.ID, TestFindController);
|
||||
|
||||
findController.start({
|
||||
forceRevealReplace: false,
|
||||
|
||||
@@ -183,6 +183,10 @@ suite('Replace Pattern test', () => {
|
||||
assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo-newbar-newabc'), 'Newfoo-Newbar-Newabc');
|
||||
actual = ['Foo-Bar-abc'];
|
||||
assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo-newbar'), 'Newfoo-newbar');
|
||||
actual = ['foo-Bar'];
|
||||
assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo-newbar'), 'newfoo-Newbar');
|
||||
actual = ['foo-BAR'];
|
||||
assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo-newbar'), 'newfoo-NEWBAR');
|
||||
|
||||
actual = ['Foo_Bar'];
|
||||
assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo_newbar'), 'Newfoo_Newbar');
|
||||
@@ -192,6 +196,10 @@ suite('Replace Pattern test', () => {
|
||||
assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo_newbar'), 'Newfoo_newbar');
|
||||
actual = ['Foo_Bar-abc'];
|
||||
assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo_newbar-abc'), 'Newfoo_newbar-abc');
|
||||
actual = ['foo_Bar'];
|
||||
assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo_newbar'), 'newfoo_Newbar');
|
||||
actual = ['Foo_BAR'];
|
||||
assert.equal(buildReplaceStringWithCasePreserved(actual, 'newfoo_newbar'), 'Newfoo_NEWBAR');
|
||||
});
|
||||
|
||||
test('preserve case', () => {
|
||||
@@ -227,6 +235,14 @@ suite('Replace Pattern test', () => {
|
||||
actual = replacePattern.buildReplaceString(['Foo-Bar-abc'], true);
|
||||
assert.equal(actual, 'Newfoo-newbar');
|
||||
|
||||
replacePattern = parseReplaceString('newfoo-newbar');
|
||||
actual = replacePattern.buildReplaceString(['foo-Bar'], true);
|
||||
assert.equal(actual, 'newfoo-Newbar');
|
||||
|
||||
replacePattern = parseReplaceString('newfoo-newbar');
|
||||
actual = replacePattern.buildReplaceString(['foo-BAR'], true);
|
||||
assert.equal(actual, 'newfoo-NEWBAR');
|
||||
|
||||
replacePattern = parseReplaceString('newfoo_newbar');
|
||||
actual = replacePattern.buildReplaceString(['Foo_Bar'], true);
|
||||
assert.equal(actual, 'Newfoo_Newbar');
|
||||
@@ -242,5 +258,13 @@ suite('Replace Pattern test', () => {
|
||||
replacePattern = parseReplaceString('newfoo_newbar-abc');
|
||||
actual = replacePattern.buildReplaceString(['Foo_Bar-abc'], true);
|
||||
assert.equal(actual, 'Newfoo_newbar-abc');
|
||||
|
||||
replacePattern = parseReplaceString('newfoo_newbar');
|
||||
actual = replacePattern.buildReplaceString(['foo_Bar'], true);
|
||||
assert.equal(actual, 'newfoo_Newbar');
|
||||
|
||||
replacePattern = parseReplaceString('newfoo_newbar');
|
||||
actual = replacePattern.buildReplaceString(['foo_BAR'], true);
|
||||
assert.equal(actual, 'newfoo_NEWBAR');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user