mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Bug/restore query editor tabs (#6654)
* trial run for query editor temp file fix * Fixing restore tabs bug with right layering * Moving FileService change from vscode to our code
This commit is contained in:
@@ -19,8 +19,6 @@ import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorIn
|
||||
import * as CustomInputConverter from 'sql/workbench/common/customInputConverter';
|
||||
import { NotebookInput } from 'sql/workbench/parts/notebook/common/models/notebookInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as os from 'os';
|
||||
|
||||
const EditorOpenPositioning = {
|
||||
LEFT: 'left',
|
||||
@@ -666,15 +664,6 @@ 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);
|
||||
@@ -740,4 +729,26 @@ export class EditorGroup extends Disposable {
|
||||
this.preview = this.editors[data.preview];
|
||||
}
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
async removeNonExitingEditor(): Promise<void> {
|
||||
let n = 0;
|
||||
while (n < this.editors.length) {
|
||||
let editor = this.editors[n];
|
||||
if (editor instanceof QueryInput && editor.matchInputInstanceType(FileEditorInput) && !editor.isDirty() && await editor.inputFileExists() === false && this.editors.length > 1) {
|
||||
// remove from editors list so that they do not get restored
|
||||
this.editors.splice(n, 1);
|
||||
let index = this.mru.findIndex(e => e.matches(editor));
|
||||
|
||||
// remove from MRU list otherwise later if we try to close them it leaves a sticky active editor with no data
|
||||
this.mru.splice(index, 1);
|
||||
this.active = this.isActive(editor) ? this.editors[0] : this.active;
|
||||
editor.close();
|
||||
}
|
||||
else {
|
||||
n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// {{SQL CARBON EDIT}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user