mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 17:23:40 -05:00
Merge from vscode 9bc92b48d945144abb405b9e8df05e18accb9148
This commit is contained in:
@@ -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