mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fix for SQL text file for editdata upon reload. (#8947)
* set dirty for editdata to false (prevent backup) * small wording change * Temporary fix for issue * using proper fix * Used editInputData onDidChangeDirty * Moved all code to editDataInput * Implemented fix from notebooks into editdata. * Fix for unregistering copy service * Fix in QueryEditorService * add handling in case of changes made while editing * Small optimization, removed setdirty in sql check * moved onDidChangeDirty to EditDataInput * some text changes * small fix for consistency in slickColorTheme
This commit is contained in:
@@ -57,9 +57,14 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
|
|||||||
this._refreshButtonEnabled = false;
|
this._refreshButtonEnabled = false;
|
||||||
this._useQueryFilter = false;
|
this._useQueryFilter = false;
|
||||||
|
|
||||||
// re-emit sql editor events through this editor if it exists
|
// re-emit sql editor events through this editor if it exists.
|
||||||
|
// also set dirty status to false to prevent rerendering.
|
||||||
if (this._sql) {
|
if (this._sql) {
|
||||||
this._register(this._sql.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
|
this._register(this._sql.onDidChangeDirty(async () => {
|
||||||
|
const model = await this._sql.resolve();
|
||||||
|
model.setDirty(false);
|
||||||
|
this._onDidChangeDirty.fire();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO determine is this is a table or a view
|
//TODO determine is this is a table or a view
|
||||||
|
|||||||
@@ -87,16 +87,15 @@ export class QueryEditorService implements IQueryEditorService {
|
|||||||
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
|
let docUri: URI = URI.from({ scheme: Schemas.untitled, path: filePath });
|
||||||
|
|
||||||
// Create a sql document pane with accoutrements
|
// Create a sql document pane with accoutrements
|
||||||
const fileInput = this._untitledEditorService.create({ associatedResource: docUri, mode: 'sql' });
|
const fileInput = this._untitledEditorService.create({ untitledResource: docUri, mode: 'sql' });
|
||||||
const m = await fileInput.resolve();
|
const m = await fileInput.resolve();
|
||||||
if (sqlContent) {
|
|
||||||
m.textEditorModel.setValue(sqlContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create an EditDataInput for editing
|
// Create an EditDataInput for editing
|
||||||
const resultsInput: EditDataResultsInput = this._instantiationService.createInstance(EditDataResultsInput, docUri.toString());
|
const resultsInput: EditDataResultsInput = this._instantiationService.createInstance(EditDataResultsInput, docUri.toString());
|
||||||
let editDataInput: EditDataInput = this._instantiationService.createInstance(EditDataInput, docUri, schemaName, tableName, fileInput, sqlContent, resultsInput);
|
let editDataInput: EditDataInput = this._instantiationService.createInstance(EditDataInput, docUri, schemaName, tableName, fileInput, sqlContent, resultsInput);
|
||||||
|
if (sqlContent) {
|
||||||
|
//Setting the value of the textEditorModel to sqlContent marks editor as dirty, editDataInput handles it.
|
||||||
|
m.textEditorModel.setValue(sqlContent);
|
||||||
|
}
|
||||||
const editor = await this._editorService.openEditor(editDataInput, { pinned: true });
|
const editor = await this._editorService.openEditor(editDataInput, { pinned: true });
|
||||||
let params = editor.input as EditDataInput;
|
let params = editor.input as EditDataInput;
|
||||||
return params;
|
return params;
|
||||||
|
|||||||
Reference in New Issue
Block a user