Skip to content

Commit 0edc2ea

Browse files
committed
fix: issue with syntax highlighting on rename
1 parent b4e8382 commit 0edc2ea

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/lib/editorFile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,10 +630,10 @@ export default class EditorFile {
630630
this.#tab.text = value;
631631
this.#name = value;
632632

633+
if (oldExt !== newExt) this.setMode();
634+
633635
editorManager.onupdate("rename-file");
634636
editorManager.emit("rename-file", this);
635-
636-
if (oldExt !== newExt) this.setMode();
637637
})();
638638
}
639639

src/lib/editorManager.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,8 @@ async function EditorManager($header, $body) {
14581458
manager.on(["rename-file"], (file) => {
14591459
if (file?.type !== "editor") return;
14601460
if (manager.activeFile?.id === file.id) {
1461+
// Re-apply file to editor to update language/syntax highlighting
1462+
applyFileToEditor(file);
14611463
void configureLspForFile(file);
14621464
}
14631465
});

0 commit comments

Comments
 (0)