mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-22 09:35:37 -05:00
Make createEditorInput async (#20038)
This commit is contained in:
@@ -71,7 +71,7 @@ export default class EditorComponent extends ComponentBase<azdata.EditorProperti
|
||||
this._editor.setVisible(true);
|
||||
let uri = this.createUri();
|
||||
|
||||
this._editorInput = this.editorService.createEditorInput({ forceUntitled: true, resource: uri, mode: 'plaintext' }) as UntitledTextEditorInput;
|
||||
this._editorInput = await this.editorService.createEditorInput({ forceUntitled: true, resource: uri, mode: 'plaintext' }) as UntitledTextEditorInput;
|
||||
|
||||
await this._editor.setInput(this._editorInput, undefined, undefined);
|
||||
const model = await this._editorInput.resolve();
|
||||
|
||||
@@ -782,15 +782,15 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
|
||||
priority: RegisteredEditorPriority.builtin
|
||||
},
|
||||
{},
|
||||
(editorInput, group) => {
|
||||
const fileInput = this._editorService.createEditorInput(editorInput) as FileEditorInput;
|
||||
async (editorInput, group) => {
|
||||
const fileInput = await this._editorService.createEditorInput(editorInput) as FileEditorInput;
|
||||
// Try to convert the input, falling back to just a plain file input if we're unable to
|
||||
const newInput = this.convertInput(fileInput);
|
||||
return { editor: newInput, options: editorInput.options, group: group };
|
||||
},
|
||||
undefined,
|
||||
(diffEditorInput, group) => {
|
||||
const diffEditorInputImpl = this._editorService.createEditorInput(diffEditorInput) as DiffEditorInput;
|
||||
async (diffEditorInput, group) => {
|
||||
const diffEditorInputImpl = await this._editorService.createEditorInput(diffEditorInput) as DiffEditorInput;
|
||||
// Try to convert the input, falling back to the original input if we're unable to
|
||||
const newInput = this.convertInput(diffEditorInputImpl);
|
||||
return { editor: newInput, options: diffEditorInput.options, group: group };
|
||||
|
||||
@@ -546,8 +546,8 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
|
||||
// Fall back to using the normal text based diff editor - we don't want the query bar and related items showing up in the diff editor
|
||||
canHandleDiff: () => false
|
||||
},
|
||||
(editorInput, group) => {
|
||||
const fileInput = this._editorService.createEditorInput(editorInput) as FileEditorInput;
|
||||
async (editorInput, group) => {
|
||||
const fileInput = await this._editorService.createEditorInput(editorInput) as FileEditorInput;
|
||||
const langAssociation = languageAssociationRegistry.getAssociationForLanguage(lang);
|
||||
const queryEditorInput = langAssociation?.syncConvertInput?.(fileInput);
|
||||
if (!queryEditorInput) {
|
||||
|
||||
@@ -309,7 +309,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
fileInput = this._instantiationService.createInstance(UntitledTextEditorInput, model);
|
||||
} else {
|
||||
let input: any = { forceFile: true, resource: uri, mode: languageMode };
|
||||
fileInput = this._editorService.createEditorInput(input);
|
||||
fileInput = await this._editorService.createEditorInput(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
|
||||
// Create a sql document pane with accoutrements
|
||||
const mode = this._connectionManagementService.getProviderLanguageMode(connectionProviderName);
|
||||
const fileInput = this._editorService.createEditorInput({ forceUntitled: true, resource: docUri, mode: mode }) as UntitledTextEditorInput;
|
||||
const fileInput = await this._editorService.createEditorInput({ forceUntitled: true, resource: docUri, mode: mode }) as UntitledTextEditorInput;
|
||||
let untitledEditorModel = await fileInput.resolve();
|
||||
if (options.initalContent) {
|
||||
untitledEditorModel.textEditorModel.setValue(options.initalContent);
|
||||
@@ -102,7 +102,7 @@ export class QueryEditorService implements IQueryEditorService {
|
||||
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
|
||||
|
||||
// Create a sql document pane with accoutrements
|
||||
const fileInput = this._editorService.createEditorInput({ forceUntitled: true, resource: docUri, mode: 'sql' }) as UntitledTextEditorInput;
|
||||
const fileInput = await this._editorService.createEditorInput({ forceUntitled: true, resource: docUri, mode: 'sql' }) as UntitledTextEditorInput;
|
||||
const m = await fileInput.resolve();
|
||||
//when associatedResource editor is created it is dirty, this must be set to false to be able to detect changes to the editor.
|
||||
(m as UntitledTextEditorModel).setDirty(false);
|
||||
|
||||
@@ -20,8 +20,8 @@ export class TestQueryEditorService implements IQueryEditorService {
|
||||
@IEditorService private readonly editorService: IEditorService) {
|
||||
}
|
||||
|
||||
newSqlEditor(options?: INewSqlEditorOptions): Promise<IUntitledQueryEditorInput> {
|
||||
const base = this.editorService.createEditorInput({ resource: undefined, forceUntitled: true }) as UntitledTextEditorInput;
|
||||
async newSqlEditor(options?: INewSqlEditorOptions): Promise<IUntitledQueryEditorInput> {
|
||||
const base = await this.editorService.createEditorInput({ resource: undefined, forceUntitled: true }) as UntitledTextEditorInput;
|
||||
return Promise.resolve(this.instantiationService.createInstance(UntitledQueryEditorInput, '', base, new QueryResultsInput(base.resource.toString(true))));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user