mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 01:25:38 -05:00
Add more to strict nulls (#11871)
* add more to strict nulls * maintain error handling properly * fix lint
This commit is contained in:
@@ -13,15 +13,17 @@ const languageRegistry = Registry.as<ILanguageAssociationRegistry>(ILanguageAsso
|
||||
|
||||
export function doHandleUpgrade(editor?: EditorInput): EditorInput | undefined {
|
||||
if (editor instanceof UntitledTextEditorInput || editor instanceof FileEditorInput) {
|
||||
let language: string;
|
||||
let language: string | undefined;
|
||||
if (editor instanceof UntitledTextEditorInput) {
|
||||
language = editor.getMode();
|
||||
} else {
|
||||
editor.getPreferredMode();
|
||||
language = editor.getPreferredMode();
|
||||
}
|
||||
const association = languageRegistry.getAssociationForLanguage(language);
|
||||
if (association && association.syncConvertinput) {
|
||||
return association.syncConvertinput(editor);
|
||||
if (language) {
|
||||
const association = languageRegistry.getAssociationForLanguage(language);
|
||||
if (association && association.syncConvertinput) {
|
||||
return association.syncConvertinput(editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
return editor;
|
||||
|
||||
@@ -25,8 +25,8 @@ type ILanguageAssociationSignature<Services extends BrandedService[]> = new (...
|
||||
|
||||
export interface ILanguageAssociationRegistry {
|
||||
registerLanguageAssociation<Services extends BrandedService[]>(languages: string[], contribution: ILanguageAssociationSignature<Services>, isDefault?: boolean): IDisposable;
|
||||
getAssociationForLanguage(language: string): ILanguageAssociation;
|
||||
readonly defaultAssociation: [string, ILanguageAssociation];
|
||||
getAssociationForLanguage(language: string): ILanguageAssociation | undefined;
|
||||
readonly defaultAssociation: [string, ILanguageAssociation] | undefined;
|
||||
|
||||
/**
|
||||
* Starts the registry by providing the required services.
|
||||
|
||||
Reference in New Issue
Block a user