mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user