From f8e9586be37f2de2b143d43d8ccb363063909b41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20T=C3=B3th?= Date: Sun, 15 Sep 2019 17:10:06 -0700 Subject: [PATCH] Run IDE language detection only when selected file is changed --- src/app/ide/ide.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/ide/ide.component.ts b/src/app/ide/ide.component.ts index d64b0e4..ae6103c 100644 --- a/src/app/ide/ide.component.ts +++ b/src/app/ide/ide.component.ts @@ -31,6 +31,7 @@ export class IdeComponent implements OnInit { files: string[]; filename = ''; + lastFilename = ''; code = 'Loading your file...'; codeState = CodeState.SAVED; @@ -94,7 +95,10 @@ export class IdeComponent implements OnInit { } this.code = (message.content != null) ? message.content : this.code; this.files = message.files; - this.autoDetectEditorLanguage(this.filename); + if (this.lastFilename !== this.filename) { + this.autoDetectEditorLanguage(this.filename); + } + this.lastFilename = this.filename; } }