From d7df71c8bafde2bff6e1a7d8fc66694613f7576f Mon Sep 17 00:00:00 2001 From: udeeshagautam <46980425+udeeshagautam@users.noreply.github.com> Date: Thu, 30 May 2019 18:39:42 -0700 Subject: [PATCH] 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 --- src/vs/workbench/common/editor/editorGroup.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/vs/workbench/common/editor/editorGroup.ts b/src/vs/workbench/common/editor/editorGroup.ts index 48feb10216..207c5c4bff 100644 --- a/src/vs/workbench/common/editor/editorGroup.ts +++ b/src/vs/workbench/common/editor/editorGroup.ts @@ -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('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);