mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 09:35:37 -05:00
More layering and strictness (#9004)
* move handling generated files to the serilization classes * remove unneeded methods * add more folders to strictire compile, add more strict compile options * update ci * wip * add more layering and fix issues * add more strictness * remove unnecessary assertion * add missing checks * fix indentation * wip * remove jsdoc * fix layering * fix compile * fix compile errors * wip * wip * finish layering * fix css * more layering * remove no longer good parts * fix issues with startup * another try * fix startup
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/common/editor/untitledTextEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { Extensions as ILanguageAssociationExtensions, ILanguageAssociationRegistry } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
|
||||
const languageRegistry = Registry.as<ILanguageAssociationRegistry>(ILanguageAssociationExtensions.LanguageAssociations);
|
||||
|
||||
export function doHandleUpgrade(editor?: EditorInput): EditorInput | undefined {
|
||||
if (editor instanceof UntitledTextEditorInput || editor instanceof FileEditorInput) {
|
||||
let language: string;
|
||||
if (editor instanceof UntitledTextEditorInput) {
|
||||
language = editor.getMode();
|
||||
} else {
|
||||
editor.getPreferredMode();
|
||||
}
|
||||
const association = languageRegistry.getAssociationForLanguage(language);
|
||||
if (association) {
|
||||
return association.convertInput(editor);
|
||||
}
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
Reference in New Issue
Block a user