From aed758dffc7f35474f100d73e7f3d217ed322222 Mon Sep 17 00:00:00 2001 From: Lukas Bach Date: Thu, 28 Sep 2023 02:04:27 +0200 Subject: [PATCH] extensions warning --- src/codeFilesPlugin.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/codeFilesPlugin.ts b/src/codeFilesPlugin.ts index b578c53..3179f6e 100644 --- a/src/codeFilesPlugin.ts +++ b/src/codeFilesPlugin.ts @@ -13,7 +13,19 @@ export default class CodeFilesPlugin extends Plugin { await this.loadSettings(); this.registerView(viewType, (leaf) => new CodeEditorView(leaf, this)); - this.registerExtensions(this.settings.extensions, viewType); + + try { + this.registerExtensions(this.settings.extensions, viewType); + } catch (e) { + console.log("code-files plugin error:", e); + new Notification("Code Files Plugin Error", { + body: + `Could not register extensions ${this.settings.extensions.join( + ", " + )}; there are probably some other extensions that already registered them. ` + + `Please change code-files's extensions in the plugin settings or remove conflicting plugins.`, + }); + } this.addCommand({ id: "open-codeblock-in-monaco",