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:
Alex Ma
2020-01-29 13:03:27 -08:00
committed by GitHub
parent 89554e5c14
commit a5a8c9761e
3 changed files with 14 additions and 10 deletions

View File

@@ -57,9 +57,14 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
this._refreshButtonEnabled = 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) {
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

View File

@@ -87,16 +87,15 @@ 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._untitledEditorService.create({ associatedResource: docUri, mode: 'sql' });
const fileInput = this._untitledEditorService.create({ untitledResource: docUri, mode: 'sql' });
const m = await fileInput.resolve();
if (sqlContent) {
m.textEditorModel.setValue(sqlContent);
}
// Create an EditDataInput for editing
const resultsInput: EditDataResultsInput = this._instantiationService.createInstance(EditDataResultsInput, docUri.toString());
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 });
let params = editor.input as EditDataInput;
return params;