mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 01:25:37 -05:00
Merge from vscode 9bc92b48d945144abb405b9e8df05e18accb9148
This commit is contained in:
@@ -39,7 +39,7 @@ export class MainThreadQueryEditor extends Disposable implements MainThreadQuery
|
||||
public $connect(fileUri: string, connectionId: string): Thenable<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let editors = this._editorService.visibleControls.filter(resource => {
|
||||
return !!resource && resource.input.getResource().toString() === fileUri;
|
||||
return !!resource && resource.input.resource.toString() === fileUri;
|
||||
});
|
||||
let editor = editors && editors.length > 0 ? editors[0] : undefined;
|
||||
let options: IConnectionCompletionOptions = {
|
||||
@@ -76,7 +76,7 @@ export class MainThreadQueryEditor extends Disposable implements MainThreadQuery
|
||||
public $connectWithProfile(fileUri: string, connection: azdata.connection.ConnectionProfile): Thenable<void> {
|
||||
return new Promise<void>(async (resolve, reject) => {
|
||||
let editors = this._editorService.visibleControls.filter(resource => {
|
||||
return !!resource && resource.input.getResource().toString() === fileUri;
|
||||
return !!resource && resource.input.resource.toString() === fileUri;
|
||||
});
|
||||
let editor = editors && editors.length > 0 ? editors[0] : undefined;
|
||||
|
||||
@@ -97,7 +97,7 @@ export class MainThreadQueryEditor extends Disposable implements MainThreadQuery
|
||||
}
|
||||
|
||||
public $runQuery(fileUri: string, runCurrentQuery: boolean = true): void {
|
||||
let filteredEditors = this._editorService.visibleControls.filter(editor => editor.input.getResource().toString() === fileUri);
|
||||
let filteredEditors = this._editorService.visibleControls.filter(editor => editor.input.resource.toString() === fileUri);
|
||||
if (filteredEditors && filteredEditors.length > 0) {
|
||||
let editor = filteredEditors[0];
|
||||
if (editor instanceof QueryEditor) {
|
||||
@@ -119,7 +119,7 @@ export class MainThreadQueryEditor extends Disposable implements MainThreadQuery
|
||||
|
||||
public $createQueryTab(fileUri: string, title: string, componentId: string): void {
|
||||
let editors = this._editorService.visibleControls.filter(resource => {
|
||||
return !!resource && resource.input.getResource().toString() === fileUri;
|
||||
return !!resource && resource.input.resource.toString() === fileUri;
|
||||
});
|
||||
|
||||
let editor = editors && editors.length > 0 ? editors[0] : undefined;
|
||||
|
||||
@@ -114,7 +114,7 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
||||
public save(): Promise<IEditorInput | undefined> { return Promise.resolve(undefined); }
|
||||
public getTypeId(): string { return EditDataInput.ID; }
|
||||
public setBootstrappedTrue(): void { this._hasBootstrapped = true; }
|
||||
public getResource(): URI { return this._uri; }
|
||||
public get resource(): URI { return this._uri; }
|
||||
public supportsSplitEditor(): boolean { return false; }
|
||||
public setupComplete() { this._setup = true; }
|
||||
public get queryString(): string {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
/**
|
||||
* Input for the EditDataResultsEditor. This input helps with logic for the viewing and editing of
|
||||
@@ -102,4 +103,8 @@ export class EditDataResultsInput extends EditorInput {
|
||||
get uri(): string {
|
||||
return unescape(this._uri);
|
||||
}
|
||||
|
||||
get resource(): URI | undefined {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ export class DashboardInput extends EditorInput {
|
||||
|
||||
// vscode has a comment that Mode's will eventually be removed (not sure the state of this comment)
|
||||
// so this might be able to be undone when that happens
|
||||
if (!model.getModel(this.getResource())) {
|
||||
model.createModel('', modeService.create('dashboard'), this.getResource());
|
||||
if (!model.getModel(this.resource)) {
|
||||
model.createModel('', modeService.create('dashboard'), this.resource);
|
||||
}
|
||||
this._initializedPromise = _connectionService.connectIfNotConnected(_connectionProfile, 'dashboard').then(
|
||||
u => {
|
||||
@@ -72,7 +72,7 @@ export class DashboardInput extends EditorInput {
|
||||
return DashboardInput.ID;
|
||||
}
|
||||
|
||||
public getResource(): URI {
|
||||
public get resource(): URI {
|
||||
return URI.from({
|
||||
scheme: 'dashboard',
|
||||
path: 'dashboard'
|
||||
|
||||
@@ -287,4 +287,8 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
|
||||
super.dispose();
|
||||
this._profilerService.disconnectSession(this.id);
|
||||
}
|
||||
|
||||
get resource(): URI | undefined {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,11 +89,11 @@ export class ModelViewInput extends EditorInput {
|
||||
return this._title;
|
||||
}
|
||||
|
||||
public getResource(): URI {
|
||||
public get resource(): URI | undefined {
|
||||
if (this._options.resourceName) {
|
||||
return URI.from({ scheme: ModelViewInput.Scheme, path: this._options.resourceName });
|
||||
}
|
||||
return super.getResource();
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public get container(): HTMLElement {
|
||||
|
||||
@@ -196,7 +196,7 @@ export class QueryTextEditor extends BaseTextEditor {
|
||||
this.refreshEditorConfiguration();
|
||||
}
|
||||
|
||||
private refreshEditorConfiguration(configuration = this.textResourceConfigurationService.getValue<IEditorConfiguration>(this.input.getResource())): void {
|
||||
private refreshEditorConfiguration(configuration = this.textResourceConfigurationService.getValue<IEditorConfiguration>(this.input.resource)): void {
|
||||
if (!this.getControl()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ export function getCurrentGlobalConnection(objectExplorerService: IObjectExplore
|
||||
|
||||
let activeInput = workbenchEditorService.activeEditor;
|
||||
if (activeInput) {
|
||||
connection = connectionManagementService.getConnectionProfile(activeInput.getResource().toString());
|
||||
connection = connectionManagementService.getConnectionProfile(activeInput.resource.toString());
|
||||
}
|
||||
|
||||
return connection;
|
||||
|
||||
@@ -166,7 +166,7 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab
|
||||
}
|
||||
|
||||
// Getters for private properties
|
||||
public get uri(): string { return this.getResource()!.toString(true); }
|
||||
public get uri(): string { return this.resource!.toString(true); }
|
||||
public get text(): EditorInput { return this._text; }
|
||||
public get results(): QueryResultsInput { return this._results; }
|
||||
// Description is shown beside the tab name in the combobox of open editors
|
||||
@@ -191,7 +191,7 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab
|
||||
|
||||
// Forwarding resource functions to the inline sql file editor
|
||||
public isDirty(): boolean { return this._text.isDirty(); }
|
||||
public getResource(): URI | undefined { return this._text.getResource(); }
|
||||
public get resource(): URI | undefined { return this._text.resource; }
|
||||
|
||||
public matchInputInstanceType(inputType: any): boolean {
|
||||
return (this._text instanceof inputType);
|
||||
|
||||
@@ -12,6 +12,7 @@ import { QueryPlanState } from 'sql/workbench/common/editor/query/queryPlanState
|
||||
import { MessagePanelState } from 'sql/workbench/common/editor/query/messagePanelState';
|
||||
import { GridPanelState } from 'sql/workbench/common/editor/query/gridPanelState';
|
||||
import { QueryModelViewState } from 'sql/workbench/common/editor/query/modelViewState';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
export class ResultsViewState {
|
||||
public readonly gridPanelState: GridPanelState = new GridPanelState();
|
||||
@@ -89,4 +90,8 @@ export class QueryResultsInput extends EditorInput {
|
||||
get uri(): string {
|
||||
return this._uri;
|
||||
}
|
||||
|
||||
get resource(): URI | undefined {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
|
||||
|
||||
// If an open and connectable query editor exists for the given URI, attach it to the connection profile
|
||||
private async processFile(uriString: string, profile: IConnectionProfile, warnOnConnectFailure: boolean): Promise<void> {
|
||||
let activeEditor = this._editorService.editors.filter(v => v.getResource().toString() === uriString).pop();
|
||||
let activeEditor = this._editorService.editors.filter(v => v.resource.toString() === uriString).pop();
|
||||
if (activeEditor instanceof QueryEditorInput && activeEditor.state.connected) {
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.none, input: activeEditor },
|
||||
|
||||
@@ -49,12 +49,12 @@ export class EditorReplacementContribution implements IWorkbenchContribution {
|
||||
}
|
||||
|
||||
if (!language) { // in the case the input doesn't have a preferred mode set we will attempt to guess the mode from the file path
|
||||
language = this.modeService.getModeIdByFilepathOrFirstLine(editor.getResource());
|
||||
language = this.modeService.getModeIdByFilepathOrFirstLine(editor.resource);
|
||||
}
|
||||
|
||||
if (!language) {
|
||||
// just use the extension
|
||||
language = path.extname(editor.getResource().toString()).slice(1); // remove the .
|
||||
language = path.extname(editor.resource.toString()).slice(1); // remove the .
|
||||
}
|
||||
|
||||
if (!language) {
|
||||
|
||||
@@ -211,7 +211,7 @@ export abstract class NotebookInput extends EditorInput {
|
||||
private _notebookFindModel: NotebookFindModel;
|
||||
|
||||
constructor(private _title: string,
|
||||
private resource: URI,
|
||||
private _resource: URI,
|
||||
private _textInput: TextInput,
|
||||
@ITextModelService private textModelService: ITextModelService,
|
||||
@IInstantiationService private instantiationService: IInstantiationService,
|
||||
@@ -219,7 +219,6 @@ export abstract class NotebookInput extends EditorInput {
|
||||
@IExtensionService private extensionService: IExtensionService
|
||||
) {
|
||||
super();
|
||||
this.resource = resource;
|
||||
this._standardKernels = [];
|
||||
this._providersLoaded = this.assignProviders();
|
||||
this._notebookEditorOpenedTimestamp = Date.now();
|
||||
@@ -299,8 +298,8 @@ export abstract class NotebookInput extends EditorInput {
|
||||
|
||||
private async setTrustForNewEditor(newInput: IEditorInput | undefined): Promise<void> {
|
||||
let isTrusted = this._model.getNotebookModel().trustedMode;
|
||||
if (isTrusted && newInput && newInput.getResource() !== this.getResource()) {
|
||||
await this.notebookService.serializeNotebookStateChange(newInput.getResource(), NotebookChangeType.Saved, undefined, true);
|
||||
if (isTrusted && newInput && newInput.resource !== this.resource) {
|
||||
await this.notebookService.serializeNotebookStateChange(newInput.resource, NotebookChangeType.Saved, undefined, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,8 +336,8 @@ export abstract class NotebookInput extends EditorInput {
|
||||
|
||||
public abstract getTypeId(): string;
|
||||
|
||||
getResource(): URI {
|
||||
return this.resource;
|
||||
get resource(): URI {
|
||||
return this._resource;
|
||||
}
|
||||
|
||||
public get untitledEditorModel(): IUntitledTextEditorModel {
|
||||
|
||||
@@ -260,7 +260,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
|
||||
let editors = this.editorService.visibleControls;
|
||||
for (let editor of editors) {
|
||||
if (editor && editor.input.getResource() === this._notebookParams.input.notebookUri) {
|
||||
if (editor && editor.input.resource === this._notebookParams.input.notebookUri) {
|
||||
await editor.group.closeEditor(this._notebookParams.input as NotebookInput, { preserveFocus: true }); // sketchy
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ export class NotebookEditorInputAssociation implements ILanguageAssociation {
|
||||
|
||||
convertInput(activeEditor: IEditorInput): NotebookInput {
|
||||
if (activeEditor instanceof FileEditorInput) {
|
||||
return this.instantiationService.createInstance(FileNotebookInput, activeEditor.getName(), activeEditor.getResource(), activeEditor);
|
||||
return this.instantiationService.createInstance(FileNotebookInput, activeEditor.getName(), activeEditor.resource, activeEditor);
|
||||
} else if (activeEditor instanceof UntitledTextEditorInput) {
|
||||
return this.instantiationService.createInstance(UntitledNotebookInput, activeEditor.getName(), activeEditor.getResource(), activeEditor);
|
||||
return this.instantiationService.createInstance(UntitledNotebookInput, activeEditor.getName(), activeEditor.resource, activeEditor);
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export class FileNoteBookEditorInputFactory implements IEditorInputFactory {
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileNotebookInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(FILE_EDITOR_INPUT_ID);
|
||||
const fileEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as FileEditorInput;
|
||||
return instantiationService.createInstance(FileNotebookInput, fileEditorInput.getName(), fileEditorInput.getResource(), fileEditorInput);
|
||||
return instantiationService.createInstance(FileNotebookInput, fileEditorInput.getName(), fileEditorInput.resource, fileEditorInput);
|
||||
}
|
||||
|
||||
canSerialize(): boolean { // we can always serialize notebooks
|
||||
@@ -68,7 +68,7 @@ export class UntitledNoteBookEditorInputFactory implements IEditorInputFactory {
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledNotebookInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(UntitledTextEditorInput.ID);
|
||||
const untitledEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as UntitledTextEditorInput;
|
||||
return instantiationService.createInstance(UntitledNotebookInput, untitledEditorInput.getName(), untitledEditorInput.getResource(), untitledEditorInput);
|
||||
return instantiationService.createInstance(UntitledNotebookInput, untitledEditorInput.getName(), untitledEditorInput.resource, untitledEditorInput);
|
||||
}
|
||||
|
||||
canSerialize(): boolean { // we can always serialize notebooks
|
||||
|
||||
@@ -115,7 +115,7 @@ suite('Notebook Input', function (): void {
|
||||
assert.strictEqual(untitledNotebookInput.untitledEditorModel, testModel);
|
||||
|
||||
// getResource
|
||||
assert.strictEqual(untitledNotebookInput.getResource(), untitledUri);
|
||||
assert.strictEqual(untitledNotebookInput.resource, untitledUri);
|
||||
|
||||
// Standard kernels
|
||||
let testKernels = [{
|
||||
|
||||
@@ -96,12 +96,12 @@ export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchCont
|
||||
}
|
||||
|
||||
private _onEditorClosed(event: IEditorCloseEvent): void {
|
||||
let uri = event.editor.getResource().toString();
|
||||
let uri = event.editor.resource.toString();
|
||||
if (uri && uri in this._sqlStatusEditors) {
|
||||
// If active editor is being closed, hide the query status.
|
||||
let activeEditor = this.editorService.activeControl;
|
||||
if (activeEditor) {
|
||||
let currentUri = activeEditor.input.getResource().toString();
|
||||
let currentUri = activeEditor.input.resource.toString();
|
||||
if (uri === currentUri) {
|
||||
this.hide();
|
||||
}
|
||||
@@ -114,7 +114,7 @@ export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchCont
|
||||
private _onEditorsChanged(): void {
|
||||
let activeEditor = this.editorService.activeControl;
|
||||
if (activeEditor) {
|
||||
let uri = activeEditor.input.getResource().toString();
|
||||
let uri = activeEditor.input.resource.toString();
|
||||
|
||||
// Show active editor's language flavor status
|
||||
if (uri) {
|
||||
@@ -145,7 +145,7 @@ export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchCont
|
||||
private _showStatus(uri: string): void {
|
||||
let activeEditor = this.editorService.activeControl;
|
||||
if (activeEditor) {
|
||||
let currentUri = activeEditor.input.getResource().toString();
|
||||
let currentUri = activeEditor.input.resource.toString();
|
||||
if (uri === currentUri) {
|
||||
let flavor: SqlProviderEntry = this._sqlStatusEditors[uri];
|
||||
if (flavor) {
|
||||
@@ -186,7 +186,7 @@ export class ChangeFlavorAction extends Action {
|
||||
|
||||
public run(): Promise<any> {
|
||||
let activeEditor = this._editorService.activeControl;
|
||||
let currentUri = activeEditor?.input.getResource().toString();
|
||||
let currentUri = activeEditor?.input.resource.toString();
|
||||
if (this._connectionManagementService.isConnected(currentUri)) {
|
||||
let currentProvider = this._connectionManagementService.getProviderIdFromUri(currentUri);
|
||||
return this._showMessage(Severity.Info, nls.localize('alreadyConnected',
|
||||
@@ -226,4 +226,3 @@ export class ChangeFlavorAction extends Action {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ export class QueryEditor extends BaseEditor {
|
||||
this.queryEditorVisible = queryContext.QueryEditorVisibleContext.bindTo(contextKeyService);
|
||||
|
||||
// Clear view state for deleted files
|
||||
this._register(fileService.onFileChanges(e => this.onFilesChanged(e)));
|
||||
this._register(fileService.onDidFilesChange(e => this.onFilesChanged(e)));
|
||||
}
|
||||
|
||||
private onFilesChanged(e: FileChangesEvent): void {
|
||||
@@ -317,7 +317,7 @@ export class QueryEditor extends BaseEditor {
|
||||
this.inputDisposables.add(this.input.state.onChange(c => this.updateState(c)));
|
||||
this.updateState({ connectingChange: true, connectedChange: true, executingChange: true, resultsVisibleChange: true, sqlCmdModeChanged: true });
|
||||
|
||||
const editorViewState = this.loadTextEditorViewState(this.input.getResource());
|
||||
const editorViewState = this.loadTextEditorViewState(this.input.resource);
|
||||
|
||||
if (editorViewState && editorViewState.resultsHeight && this.splitview.length > 1) {
|
||||
this.splitview.resizeView(1, editorViewState.resultsHeight);
|
||||
@@ -331,7 +331,7 @@ export class QueryEditor extends BaseEditor {
|
||||
|
||||
// Otherwise we save the view state to restore it later
|
||||
else if (!input.isDisposed()) {
|
||||
this.saveTextEditorViewState(input.getResource());
|
||||
this.saveTextEditorViewState(input.resource);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
@IEditorService private readonly editorService: IEditorService) { }
|
||||
|
||||
convertInput(activeEditor: IEditorInput): QueryEditorInput | undefined {
|
||||
const queryResultsInput = this.instantiationService.createInstance(QueryResultsInput, activeEditor.getResource().toString(true));
|
||||
const queryResultsInput = this.instantiationService.createInstance(QueryResultsInput, activeEditor.resource.toString(true));
|
||||
let queryEditorInput: QueryEditorInput;
|
||||
if (activeEditor instanceof FileEditorInput) {
|
||||
queryEditorInput = this.instantiationService.createInstance(FileQueryEditorInput, '', activeEditor, queryResultsInput);
|
||||
@@ -81,8 +81,8 @@ export class FileQueryEditorInputFactory implements IEditorInputFactory {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(FILE_EDITOR_INPUT_ID);
|
||||
const fileEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as FileEditorInput;
|
||||
// only successfully deserilize the file if the resource actually exists
|
||||
if (this.fileService.exists(fileEditorInput.getResource())) {
|
||||
const queryResultsInput = instantiationService.createInstance(QueryResultsInput, fileEditorInput.getResource().toString());
|
||||
if (this.fileService.exists(fileEditorInput.resource)) {
|
||||
const queryResultsInput = instantiationService.createInstance(QueryResultsInput, fileEditorInput.resource.toString());
|
||||
return instantiationService.createInstance(FileQueryEditorInput, '', fileEditorInput, queryResultsInput);
|
||||
} else {
|
||||
fileEditorInput.dispose();
|
||||
@@ -110,7 +110,7 @@ export class UntitledQueryEditorInputFactory implements IEditorInputFactory {
|
||||
deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledQueryEditorInput | undefined {
|
||||
const factory = editorInputFactoryRegistry.getEditorInputFactory(UntitledTextEditorInput.ID);
|
||||
const untitledEditorInput = factory.deserialize(instantiationService, serializedEditorInput) as UntitledTextEditorInput;
|
||||
const queryResultsInput = instantiationService.createInstance(QueryResultsInput, untitledEditorInput.getResource().toString());
|
||||
const queryResultsInput = instantiationService.createInstance(QueryResultsInput, untitledEditorInput.resource.toString());
|
||||
return instantiationService.createInstance(UntitledQueryEditorInput, '', untitledEditorInput, queryResultsInput);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ export class QueryPlanConverter implements ILanguageAssociation {
|
||||
constructor(@IInstantiationService private instantiationService: IInstantiationService) { }
|
||||
|
||||
convertInput(activeEditor: IEditorInput): QueryPlanInput {
|
||||
return this.instantiationService.createInstance(QueryPlanInput, activeEditor.getResource());
|
||||
return this.instantiationService.createInstance(QueryPlanInput, activeEditor.resource);
|
||||
}
|
||||
|
||||
createBase(activeEditor: QueryPlanInput): IEditorInput {
|
||||
@@ -83,4 +83,8 @@ export class QueryPlanInput extends EditorInput {
|
||||
public get uniqueSelector(): string {
|
||||
return this._uniqueSelector;
|
||||
}
|
||||
|
||||
get resource(): URI | undefined {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user