Do not add generated files from Temp if file is not dirty (#5758)

* Do not add generated files from Temp if file is not dirty

* restricting the path more

* Adding tmpdir as per CR comment
This commit is contained in:
udeeshagautam
2019-05-30 18:39:42 -07:00
committed by GitHub
parent ea464abaaf
commit d7df71c8ba

View File

@@ -18,6 +18,9 @@ import { QueryInput } from 'sql/workbench/parts/query/common/queryInput';
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
import * as CustomInputConverter from 'sql/workbench/common/customInputConverter';
import { NotebookInput } from 'sql/workbench/parts/notebook/notebookInput';
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
import * as path from 'path';
import * as os from 'os';
const EditorOpenPositioning = {
LEFT: 'left',
@@ -663,6 +666,15 @@ export class EditorGroup extends Disposable {
&& !this.configurationService.getValue<boolean>('sql.promptToSaveGeneratedFiles')) {
return;
}
// Do not add generated files from Temp if file is not dirty
if (e instanceof FileEditorInput && !e.isDirty()) {
let filePath = e.getResource() ? e.getResource().fsPath : undefined;
let tempPath = os.tmpdir();
if (filePath && tempPath &&
filePath.toLocaleLowerCase().includes(path.join(tempPath.toLocaleLowerCase(), 'mssql_definition'))) {
return;
}
}
// {{SQL CARBON EDIT}} - End
const value = factory.serialize(e);