Skip to content

Commit e206372

Browse files
authored
file: re-emit switch and load file events after plugin load (#1252)
re-emit 'switch-file' and 'file-loaded' event after loading plugins , as plugins are loaded after opening app and those events also gets triggered before loading plugins, so many plugins will face issues such as lsp plugins. For compatibility it will re-emit events .
1 parent acfb8cc commit e206372

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/lib/main.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,15 @@ async function onDeviceReady() {
241241
// load plugins
242242
try {
243243
await loadPlugins();
244+
245+
// Re-emit events for active file after plugins are loaded
246+
const { activeFile } = editorManager;
247+
if (activeFile?.uri) {
248+
// Re-emit file-loaded event
249+
editorManager.emit("file-loaded", activeFile);
250+
// Re-emit switch-file event
251+
editorManager.emit("switch-file", activeFile);
252+
}
244253
} catch (error) {
245254
window.log("error", "Failed to load plugins!");
246255
window.log("error", error);

0 commit comments

Comments
 (0)