Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/cli/src/ui/components/DebugProfiler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ export const DebugProfiler = () => {
appEvents.on(eventName, handler);
}

// Register handlers for extension lifecycle events emitted on coreEvents
// but not part of the CoreEvent enum, to prevent false-positive idle warnings.
const extensionEvents = [
'extensionsStarting',
'extensionsStopping',
] as const;
Comment on lines +176 to +179
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor structural suggestion for DebugProfiler.tsx to consider for future
maintainability:

To make it easier to add new lifecycle events in the future without having to
update DebugProfiler, you might consider exporting a runtime constant array
alongside the ExtensionEvents interface definition (around line 247 in
packages/core/src/utils/extensionLoader.ts).

For example:

export const ExtensionLifecycleEvents = [
  'extensionsStarting',
  'extensionsStopping',
] as const;

export interface ExtensionEvents {
  // ...
}

If the profiler just imports and iterates over that core array instead, it will
automatically pick up any new extension events added to that list by future
developers. Just a thought for keeping the event strings centralized!

for (const eventName of extensionEvents) {
coreEvents.on(eventName, handler);
}

return () => {
stdin.off('data', handler);
stdout.off('resize', handler);
Expand All @@ -183,6 +193,10 @@ export const DebugProfiler = () => {
appEvents.off(eventName, handler);
}

for (const eventName of extensionEvents) {
coreEvents.off(eventName, handler);
}

profiler.profilersActive--;
};
}, []);
Expand Down
Loading