mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 09:35:37 -05:00
Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae
This commit is contained in:
committed by
AzureDataStudio
parent
a971aee5bd
commit
5e7071e466
@@ -89,8 +89,8 @@ export default class DiffEditorComponent extends ComponentBase implements ICompo
|
||||
}
|
||||
});
|
||||
|
||||
let editorinput1 = this._instantiationService.createInstance(ResourceEditorInput, 'source', undefined, uri1, undefined);
|
||||
let editorinput2 = this._instantiationService.createInstance(ResourceEditorInput, 'target', undefined, uri2, undefined);
|
||||
let editorinput1 = this._instantiationService.createInstance(ResourceEditorInput, uri1, 'source', undefined, undefined);
|
||||
let editorinput2 = this._instantiationService.createInstance(ResourceEditorInput, uri2, 'target', undefined, undefined);
|
||||
this._editorInput = new DiffEditorInput('DiffEditor', undefined, editorinput1, editorinput2, true);
|
||||
this._editor.setInput(this._editorInput, undefined, cancellationTokenSource.token);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { dirname, basename } from 'vs/base/common/resources';
|
||||
import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { FileKind } from 'vs/platform/files/common/files';
|
||||
import { WorkbenchAsyncDataTree, TreeResourceNavigator } from 'vs/platform/list/browser/listService';
|
||||
import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
|
||||
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import { localize } from 'vs/nls';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
@@ -487,9 +487,7 @@ export class TreeView extends Disposable implements ITreeView {
|
||||
}));
|
||||
this.tree.setInput(this.root).then(() => this.updateContentAreas());
|
||||
|
||||
const treeNavigator = new TreeResourceNavigator(this.tree, { openOnFocus: false, openOnSelection: false });
|
||||
this._register(treeNavigator);
|
||||
this._register(treeNavigator.onDidOpenResource(e => {
|
||||
this._register(this.tree.onDidOpen(e => {
|
||||
if (!e.browserEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ suite('commandLineService tests', () => {
|
||||
querymodelService.setup(c => c.onRunQueryComplete).returns(() => Event.None);
|
||||
let uri = URI.file(args._[0]);
|
||||
const workbenchinstantiationService = workbenchInstantiationService();
|
||||
const editorInput = workbenchinstantiationService.createInstance(FileEditorInput, uri, undefined, undefined);
|
||||
const editorInput = workbenchinstantiationService.createInstance(FileEditorInput, uri, undefined, undefined, undefined);
|
||||
const queryInput = new FileQueryEditorInput(undefined, editorInput, undefined, connectionManagementService.object, querymodelService.object, configurationService.object);
|
||||
queryInput.state.connected = true;
|
||||
const editorService: TypeMoq.Mock<IEditorService> = TypeMoq.Mock.ofType<IEditorService>(TestEditorService, TypeMoq.MockBehavior.Strict);
|
||||
|
||||
@@ -85,7 +85,7 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
|
||||
|
||||
public sendMessage(message: string): void {
|
||||
if (this._webview) {
|
||||
this._webview.sendMessage(message);
|
||||
this._webview.postMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
|
||||
|
||||
public sendMessage(message: string): void {
|
||||
if (this._webview) {
|
||||
this._webview.sendMessage(message);
|
||||
this._webview.postMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ suite('Editor Replacer Contribution', () => {
|
||||
const editorService = new MockEditorService(instantiationService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const contrib = instantiationService.createInstance(EditorReplacementContribution);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined, undefined);
|
||||
const response = editorService.fireOpenEditor(input, undefined, undefined as IEditorGroup, OpenEditorContext.NEW_EDITOR);
|
||||
assert(response?.override);
|
||||
const newinput = <any>(await response.override) as EditorInput; // our test service returns this so we are fine to cast this
|
||||
@@ -86,7 +86,7 @@ suite('Editor Replacer Contribution', () => {
|
||||
const editorService = new MockEditorService(instantiationService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const contrib = instantiationService.createInstance(EditorReplacementContribution);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.other'), undefined, 'sql');
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.other'), undefined, 'sql', undefined);
|
||||
const response = editorService.fireOpenEditor(input, undefined, undefined as IEditorGroup, OpenEditorContext.NEW_EDITOR);
|
||||
assert(response?.override);
|
||||
const newinput = <any>(await response.override) as EditorInput; // our test service returns this so we are fine to cast this
|
||||
@@ -101,7 +101,7 @@ suite('Editor Replacer Contribution', () => {
|
||||
const editorService = new MockEditorService(instantiationService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const contrib = instantiationService.createInstance(EditorReplacementContribution);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.notebook'), undefined, undefined);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.notebook'), undefined, undefined, undefined);
|
||||
const response = editorService.fireOpenEditor(input, undefined, undefined as IEditorGroup, OpenEditorContext.NEW_EDITOR);
|
||||
assert(response?.override);
|
||||
const newinput = <any>(await response.override) as EditorInput; // our test service returns this so we are fine to cast this
|
||||
@@ -116,7 +116,7 @@ suite('Editor Replacer Contribution', () => {
|
||||
const editorService = new MockEditorService(instantiationService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const contrib = instantiationService.createInstance(EditorReplacementContribution);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.iynb'), undefined, 'notebook');
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.iynb'), undefined, 'notebook', undefined);
|
||||
const response = editorService.fireOpenEditor(input, undefined, undefined as IEditorGroup, OpenEditorContext.NEW_EDITOR);
|
||||
assert(response?.override);
|
||||
const newinput = <any>(await response.override) as EditorInput; // our test service returns this so we are fine to cast this
|
||||
@@ -191,10 +191,10 @@ class MockEditorService extends TestEditorService {
|
||||
});
|
||||
}
|
||||
|
||||
fireOpenEditor(editor: IEditorInput, options: IEditorOptions | ITextEditorOptions | undefined, group: IEditorGroup, context: OpenEditorContext, id?: string) {
|
||||
fireOpenEditor(editor: IEditorInput, options: IEditorOptions | ITextEditorOptions | undefined, group: IEditorGroup, context: OpenEditorContext) {
|
||||
for (const handler of this.overridenOpens) {
|
||||
let response: IOpenEditorOverride | undefined;
|
||||
if (response = handler.open(editor, options, group, context, id)) {
|
||||
if (response = handler.open(editor, options, group, context)) {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
|
||||
private sendMessage(): void {
|
||||
if (this._webview && this.message) {
|
||||
this._webview.sendMessage(this.message);
|
||||
this._webview.postMessage(this.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
|
||||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
import { TextFileEditorModelManager } from 'vs/workbench/services/textfile/common/textFileEditorModelManager';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { TestEnvironmentService, TestLifecycleService, TestTextFileService, workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestEnvironmentService, TestLifecycleService, TestTextFileService, workbenchInstantiationService, TestTextFileEditorModelManager } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { Range } from 'vs/editor/common/core/range';
|
||||
import { nb } from 'azdata';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
@@ -884,7 +884,7 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
async function createTextEditorModel(self: Mocha.ITestCallbackContext): Promise<NotebookEditorModel> {
|
||||
let textFileEditorModel = instantiationService.createInstance(TextFileEditorModel, toResource.call(self, defaultUri.toString()), 'utf8', undefined);
|
||||
(<TextFileEditorModelManager>accessor.textFileService.files).add(textFileEditorModel.resource, textFileEditorModel);
|
||||
(<TestTextFileEditorModelManager>accessor.textFileService.files).add(textFileEditorModel.resource, textFileEditorModel);
|
||||
await textFileEditorModel.load();
|
||||
return new NotebookEditorModel(defaultUri, textFileEditorModel, mockNotebookService.object, testResourcePropertiesService);
|
||||
}
|
||||
|
||||
@@ -15,9 +15,7 @@ import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel'
|
||||
import { ITextFileEditorModel } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
type PublicPart<T> = { [K in keyof T]: T[K] };
|
||||
|
||||
export class FileQueryEditorInput extends QueryEditorInput implements PublicPart<FileEditorInput> {
|
||||
export class FileQueryEditorInput extends QueryEditorInput {
|
||||
|
||||
public static readonly ID = 'workbench.editorInput.fileQueryInput';
|
||||
|
||||
@@ -84,7 +82,7 @@ export class FileQueryEditorInput extends QueryEditorInput implements PublicPart
|
||||
return this.text.isResolved();
|
||||
}
|
||||
|
||||
public move(group: GroupIdentifier, target: URI): IMoveResult {
|
||||
return this.text.move(group, target);
|
||||
public rename(group: GroupIdentifier, target: URI): IMoveResult {
|
||||
return this.text.rename(group, target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ suite('Query Input Factory', () => {
|
||||
instantiationService.stub(IConnectionManagementService, connectionManagementService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const queryEditorLanguageAssociation = instantiationService.createInstance(QueryEditorLanguageAssociation);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined, undefined);
|
||||
queryEditorLanguageAssociation.convertInput(input);
|
||||
assert(connectionManagementService.numberConnects === 1, 'Convert input should have called connect when active OE connection exists');
|
||||
});
|
||||
@@ -49,7 +49,7 @@ suite('Query Input Factory', () => {
|
||||
instantiationService.stub(IConnectionManagementService, connectionManagementService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const queryEditorLanguageAssociation = instantiationService.createInstance(QueryEditorLanguageAssociation);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined, undefined);
|
||||
const response = queryEditorLanguageAssociation.convertInput(input);
|
||||
assert(isThenable(response));
|
||||
await response;
|
||||
@@ -64,7 +64,7 @@ suite('Query Input Factory', () => {
|
||||
instantiationService.stub(IConnectionManagementService, connectionManagementService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const queryEditorLanguageAssociation = instantiationService.createInstance(QueryEditorLanguageAssociation);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined, undefined);
|
||||
queryEditorLanguageAssociation.convertInput(input);
|
||||
assert(connectionManagementService.numberConnects === 1, 'Convert input should have called connect when active editor connection exists');
|
||||
});
|
||||
@@ -77,7 +77,7 @@ suite('Query Input Factory', () => {
|
||||
instantiationService.stub(IConnectionManagementService, connectionManagementService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const queryEditorLanguageAssociation = instantiationService.createInstance(QueryEditorLanguageAssociation);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined, undefined);
|
||||
const response = queryEditorLanguageAssociation.convertInput(input);
|
||||
assert(isThenable(response));
|
||||
await response;
|
||||
@@ -115,7 +115,7 @@ suite('Query Input Factory', () => {
|
||||
instantiationService.stub(IConnectionManagementService, connectionManagementService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const queryEditorLanguageAssociation = instantiationService.createInstance(QueryEditorLanguageAssociation);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined, undefined);
|
||||
queryEditorLanguageAssociation.syncConvertinput(input);
|
||||
assert(connectionManagementService.numberConnects === 0, 'Convert input should not have been called connect when no global connections exist');
|
||||
});
|
||||
@@ -127,7 +127,7 @@ suite('Query Input Factory', () => {
|
||||
instantiationService.stub(IConnectionManagementService, connectionManagementService);
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const queryEditorLanguageAssociation = instantiationService.createInstance(QueryEditorLanguageAssociation);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined);
|
||||
const input = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.sql'), undefined, undefined, undefined);
|
||||
const response = queryEditorLanguageAssociation.convertInput(input);
|
||||
assert(isThenable(response));
|
||||
await response;
|
||||
|
||||
@@ -145,7 +145,7 @@ export class WebViewDialog extends Modal {
|
||||
}
|
||||
|
||||
public sendMessage(message: any): void {
|
||||
this._webview.sendMessage(message);
|
||||
this._webview.postMessage(message);
|
||||
}
|
||||
|
||||
public open() {
|
||||
|
||||
@@ -61,7 +61,7 @@ suite('set mode', () => {
|
||||
const replaceEditorStub = sinon.stub(editorService, 'replaceEditors', () => Promise.resolve());
|
||||
const stub = sinon.stub();
|
||||
const modeSupport = { setMode: stub };
|
||||
const activeEditor = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.txt'), undefined, 'plaintext');
|
||||
const activeEditor = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.txt'), undefined, 'plaintext', undefined);
|
||||
await instantiationService.invokeFunction(setMode, modeSupport, activeEditor, 'json');
|
||||
assert(stub.calledOnce);
|
||||
assert(stub.calledWithExactly('json'));
|
||||
@@ -75,7 +75,7 @@ suite('set mode', () => {
|
||||
const stub = sinon.stub();
|
||||
const modeSupport = { setMode: stub };
|
||||
const uri = URI.file('/test/file.sql');
|
||||
const textInput = instantiationService.createInstance(FileEditorInput, uri, undefined, 'sql');
|
||||
const textInput = instantiationService.createInstance(FileEditorInput, uri, undefined, 'sql', undefined);
|
||||
const activeEditor = instantiationService.createInstance(FileQueryEditorInput, '', textInput, instantiationService.createInstance(QueryResultsInput, uri.toString()));
|
||||
await instantiationService.invokeFunction(setMode, modeSupport, activeEditor, 'notebooks');
|
||||
assert(stub.calledOnce);
|
||||
@@ -89,7 +89,7 @@ suite('set mode', () => {
|
||||
const stub = sinon.stub();
|
||||
const modeSupport = { setMode: stub };
|
||||
const uri = URI.file('/test/file.sql');
|
||||
const textInput = instantiationService.createInstance(FileEditorInput, uri, undefined, 'sql');
|
||||
const textInput = instantiationService.createInstance(FileEditorInput, uri, undefined, 'sql', undefined);
|
||||
const activeEditor = instantiationService.createInstance(FileQueryEditorInput, '', textInput, instantiationService.createInstance(QueryResultsInput, uri.toString()));
|
||||
await instantiationService.invokeFunction(setMode, modeSupport, activeEditor, 'plaintext');
|
||||
assert(stub.calledOnce);
|
||||
@@ -102,7 +102,7 @@ suite('set mode', () => {
|
||||
instantiationService.stub(IEditorService, editorService);
|
||||
const stub = sinon.stub();
|
||||
const modeSupport = { setMode: stub };
|
||||
const activeEditor = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.txt'), undefined, 'plaintext');
|
||||
const activeEditor = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.txt'), undefined, 'plaintext', undefined);
|
||||
await instantiationService.invokeFunction(setMode, modeSupport, activeEditor, 'sql');
|
||||
assert(stub.calledOnce);
|
||||
assert(stub.calledWithExactly('sql'));
|
||||
@@ -117,7 +117,7 @@ suite('set mode', () => {
|
||||
(instantiationService as TestInstantiationService).stub(INotificationService, 'error', errorStub);
|
||||
const stub = sinon.stub();
|
||||
const modeSupport = { setMode: stub };
|
||||
const activeEditor = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.txt'), undefined, 'plaintext');
|
||||
const activeEditor = instantiationService.createInstance(FileEditorInput, URI.file('/test/file.txt'), undefined, 'plaintext', undefined);
|
||||
sinon.stub(activeEditor, 'isDirty', () => true);
|
||||
await instantiationService.invokeFunction(setMode, modeSupport, activeEditor, 'sql');
|
||||
assert(stub.notCalled);
|
||||
@@ -136,16 +136,18 @@ class MockEditorService extends TestEditorService {
|
||||
group: {}
|
||||
};
|
||||
|
||||
activeTextEditorControl: ICodeEditor = <any>{
|
||||
getModel: () => {
|
||||
return <any>{
|
||||
getLanguageIdentifier: () => {
|
||||
return { language: this.mode };
|
||||
}
|
||||
};
|
||||
},
|
||||
getEditorType: () => EditorType.ICodeEditor
|
||||
};
|
||||
get activeTextEditorControl(): ICodeEditor {
|
||||
return {
|
||||
getModel: () => {
|
||||
return <any>{
|
||||
getLanguageIdentifier: () => {
|
||||
return { language: this.mode };
|
||||
}
|
||||
};
|
||||
},
|
||||
getEditorType: () => EditorType.ICodeEditor
|
||||
} as any;
|
||||
}
|
||||
|
||||
openEditor(_editor: any, _options?: any, _group?: any): Promise<any> {
|
||||
return Promise.resolve(_editor);
|
||||
|
||||
Reference in New Issue
Block a user