Skip to content

Commit

Permalink
Do not add generated files from Temp if file is not dirty (#5758)
Browse files Browse the repository at this point in the history
* Do not add generated files from Temp if file is not dirty

* restricting the path more

* Adding tmpdir as per CR comment
  • Loading branch information
udeeshagautam authored May 31, 2019
1 parent ea464ab commit d7df71c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/vs/workbench/common/editor/editorGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d7df71c

Please sign in to comment.