fix(plugin-sql-editor): CB-184 handle unknown dialect

This commit is contained in:
Wroud
2021-01-11 16:18:29 +03:00
parent da9e3504d1
commit 75dddead76
2 changed files with 5 additions and 3 deletions
@@ -75,9 +75,11 @@ export class CodeEditorController {
[value]: value,
}), {});
if (this.bindings.options && this.dialect.name) {
if (this.bindings.options) {
const name = this.dialect.name && findModeByName(this.dialect.name)?.mime;
this.bindings.options.mode = {
name: findModeByName(this.dialect.name).mime,
name: name || COMMON_EDITOR_CONFIGURATION.mode,
keywords,
builtin,
};
@@ -16,5 +16,5 @@ declare module 'codemirror' {
ext?: string[];
alias?: string[];
}
function findModeByName(name: string): ModeInfo;
function findModeByName(name: string): ModeInfo | undefined;
}