History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RUBY-1575
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Dmitry Jemerov
Reporter: Rick Maddy
Votes: 2
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Ruby

Ruby and IdeaVIM plugins conflict with each other

Created: 03 Jul 08 09:40   Updated: Saturday 19:04
Component/s: Editing
Fix Version/s: 2.0

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Tested under OS X 10.4.11 but shouldn't make any difference
Issue Links:
Duplicate
 
This issue is duplicated by:
RUBY-1501 Other plugins break if you install Ru... Normal Closed

Build: 7,757


 Description  « Hide
I am the author of the IdeaVIM plugin. Using Idea 7.0.3, Ruby plugin 1.0.14958 and IdeaVIM plugin 0.11.6-7.x there is an issue whenever editing any Ruby files. None of the VIM keybinding work while editing a Ruby file. The VIM bindings work fine for any non-Ruby file. The problem is both plugins replace the TypedAction using the EditorActionManager. Since the IdeaVIM plugin is an application level plugin and the Ruby plugin is a project level plugin, the Ruby plugin "wins".

I would have to guess that any language plugin such as the Ruby plugin would use its own TypedAction resulting in a conflict with the IdeaVIM plugin. So this bug report may not really be a bug with the Ruby plugin. It's more of a question of how is this issue best resolved?

Based on how the IdeaVIM plugin is written I believe this problem would go away if there was a way to swap the order of the TypeAction replacements. If all keystrokes went to the IdeaVIM key handler first, eventually the IdeaVIM plugin would call the "original" key handler. If IdeaVIM's "original" handler was the Ruby plugin, then all would work just fine. But since all key strokes go to the Ruby plugin first, then only to the "original" handler for non-Ruby files, then the IdeaVIM key handler is never called for Ruby files.

So how can I ensure that the application level IdeaVIM plugin is always the top level TypedAction with project level plugins being further down the chain? One kludge that would work only in this case would be for the Ruby plugin to be modified so the code that replaces the TypedAction does so in a way thee results in the correct order: IdeaVIM -> Ruby -> "original". But of course this won't help other project level plugins that also use their own TypedAction.

Does this make sense? I know it's a bit confusing to describe.



 All   Comments   Work Log   Change History      Sort Order:
Rick Maddy - 03 Jul 08 20:05
I've been thinking about this issue some more. The current OpenAPI (under Selena) doesn't seem to allow for a solution to this problem. Here's why. For this problem to be solved, the OpenAPI needs to allow application level plugins to take precedence over project level plugins when replacing the handler of the TypedAction. Both Ruby and IdeaVIM plugins currently replace the TypedAction handler and keep a reference to the original. Since IdeaVIM is loaded first (as an app level plugin) it has no way to know another plugin has replaced its handler with another. The Ruby plugin would have no way to update the TypedAction handler such that the IdeaVIM plugin would now know to call the Ruby handler instead of the original handler it had. So the OpenAPI needs to be updated such that a plugin can register it's own TypedAction handler as well as obtain the next handler in the chain.

But it gets even more complex. Right now the EditorActionManager is application level, not project level. What happens if I run one instance of Idea and open two projects - one using Ruby and one not using Ruby. In this case, assuming the changes have been made to ensure the app level plugin gets the key event first, the application level plugin decides to pass the key event to the original handler. The original handler would now be project specific. So there needs to be a way for the application level plugin to get the project specific handler. And this doesn't even consider module level plugins.

So the EditorActionMananger.getInstance() method probably needs to take a Project parameter or the EditorActionManager.getTypedAction needs to take a Project parameter.

To summarize, the OpenAPI and the internal framework need to be changed to support TypedAction handler chaining so a typed action can properly go from application level to project level to module level as appropriate with each level deciding how to handle the action by either consuming it or passing it on down to the next handler in the chain. Keep in mind that is should be possible for there to be multiple application and/or project level plugins in the chain at a given time. I can see another project level plugin doing what the Ruby plugin does. With these changes all should work since each language plugin would only consume the action for files specific to its language so the order of the chaining shouldn't matter at that level.

Is there any chance these changes can be made to the OpenAPI and Idea in Diana? I can't see any solution under Selena but you certainly know the internals better than me. Is there a solution for Selena?

I hope this makes sense.


Ryan Shillington - 06 Aug 08 20:15
Is there an update on this? Not being able to use Rick's plugin for my IDEA code makes me sad. This was originally reported in April.

In my opinion, IDEA stands out from Eclipse because:

  1. Better refactoring
  2. Better error highlighting
  3. Better Vi support

Breaking this plugin reduces my efficiency dramatically. Please fix!


Dan Colish - 13 Sep 08 18:02
I was devastated by this. I really don't want to use emacs, because it is my sworn enemy but I need to be able to move around my ruby scripts with out using arrow keys. Please fix this, or post some more hints on how someone else could?

Dmitry Jemerov - 03 Oct 08 21:07
The problem should be resolved now. Rick, if you need help updating IdeaVIM for IDEA 8 API compatibility, feel free to ask me - we're very interested in having a working plugin version by the time IDEA 8 is released.

Rick Maddy - 06 Oct 08 07:56
I just downloaded Diana 8858 and installed the latest Ruby plugin. The compatibility issue seems to be resolved between the IdeaVIM plugin and the Ruby plugin. I did not need to make any changes to IdeaVIM to resolve this issue.

Thanks.
Rick


Ryan Shillington - 11 Oct 08 19:04
Awesome sauce! Thanks guys!