Skip to content

Conversation

@claude
Copy link

@claude claude bot commented Jan 27, 2026

Summary

  • Inspected: src/main/java/com/maddyhome/idea/vim/statistic/PluginState.kt and related extension tracking code
  • Found a bug where disabled extensions were not being removed from statistics
  • Fixed the issue by adding proper cleanup in VimExtensionRegistrar.kt

Issues Found

When extensions were disabled via set noExtensionName or when the extension was unregistered as an extension point, they were properly disposed but not removed from PluginState.Util.enabledExtensions. This caused the statistics to incorrectly show extensions as enabled even after they were disabled.

Changes Made

Added PluginState.Util.enabledExtensions.remove(name) in two locations in VimExtensionRegistrar.kt:

  1. In the option change listener when an extension is disabled (line 73)
  2. In unregisterExtension() when an extension is unregistered (line 113)

Why This Improves the Code

  • Correctness: Statistics now accurately reflect which extensions are actually enabled
  • Consistency: Extension disposal now properly cleans up all related state, not just mappings and listeners
  • Data integrity: The FUS (Feature Usage Statistics) will now provide accurate data about extension usage

Related Code

The fix maintains consistency with the existing pattern where extensions are added to the statistics set when enabled (line 70), and now properly removes them when disabled.

🤖 Generated with Claude Code

When extensions were disabled via 'set noExtensionName' or when the extension
was unregistered as an extension point, they were properly disposed but not
removed from PluginState.Util.enabledExtensions. This caused the statistics
to incorrectly show extensions as enabled even after they were disabled.

This fix ensures that when an extension is disabled or unregistered, it is
also removed from the enabled extensions set used for statistics collection.

Changes:
- Add PluginState.Util.enabledExtensions.remove(name) in the option change listener
  when an extension is disabled
- Add PluginState.Util.enabledExtensions.remove(name) in unregisterExtension()
  when an extension is unregistered

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants