Enable hot exit for saved files (#469)

This commit is contained in:
Matt Irvine
2018-01-11 14:29:26 -08:00
committed by GitHub
parent 7cf0847ef5
commit 6d3995aa29
6 changed files with 29 additions and 26 deletions

View File

@@ -42,10 +42,6 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { isMacintosh } from 'vs/base/common/platform';
import { GroupOnePicker, GroupTwoPicker, GroupThreePicker, AllEditorsPicker } from 'vs/workbench/browser/parts/editor/editorPicker';
// {{SQL CARBON EDIT}}
import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
import { QueryInput } from 'sql/parts/query/common/queryInput';
// Register String Editor
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
new EditorDescriptor(
@@ -136,23 +132,15 @@ class UntitledEditorInputFactory implements IEditorInputFactory {
return JSON.stringify(serialized);
}
// {{SQL CARBON EDIT}}
public deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput {
return instantiationService.invokeFunction<EditorInput>(accessor => {
public deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): UntitledEditorInput {
return instantiationService.invokeFunction<UntitledEditorInput>(accessor => {
const deserialized: ISerializedUntitledEditorInput = JSON.parse(serializedEditorInput);
const resource = !!deserialized.resourceJSON ? URI.revive(deserialized.resourceJSON) : URI.parse(deserialized.resource);
const filePath = resource.scheme === 'file' ? resource.fsPath : void 0;
const language = deserialized.modeId;
const encoding = deserialized.encoding;
// {{SQL CARBON EDIT}}
let input = accessor.get(IWorkbenchEditorService).createInput({ resource, filePath, language, encoding }) as UntitledEditorInput;
if (deserialized.modeId === QueryInput.SCHEMA) {
const queryResultsInput: QueryResultsInput = instantiationService.createInstance(QueryResultsInput, resource.toString());
return instantiationService.createInstance(QueryInput, input.getName(), '', input, queryResultsInput, undefined);
} else {
return input;
}
return accessor.get(IWorkbenchEditorService).createInput({ resource, filePath, language, encoding }) as UntitledEditorInput;
});
}
}