Eclipse command plugs #762

Merged
merged 5 commits into from Sep 29, 2016

Conversation

Projects
None yet
3 participants
@albertdev
Contributor

albertdev commented Sep 14, 2016

I have been working exclusively in .NET these days which is why you no longer hear from me as often.

Anyway, the code in this pull request has been sitting on my workstation ever since the beginning of August waiting to be documented. It's a generalized alternative to @psporysz plugin in #752 so I'm hoping that someone else can give some starting pointers for documentation after the following examples for your .vrapperrc:

noremap \w <Plug>(eclipse-motion:org.eclipse.ui.edit.text.goto.wordNext)
noremap \b <Plug>(eclipse-motion:org.eclipse.ui.edit.text.goto.wordPrevious)
noremap \e <Plug>(eclipse-textobj:org.eclipse.jdt.ui.edit.text.java.select.enclosing)
noremap \l <Plug>(eclipse-textobj:org.eclipse.jdt.ui.edit.text.java.select.last)

To explain the first line: this will bind e.g. \w to Eclipse's native word-Next command and should do so for normal mode, visual mode and operator mode (the latter might not be as well-tested though).

What @psporysz would be really after though is \e - this will select the enclosing element in visual mode (entering visual mode if invoked from normal mode).

Counts work so you can also enter 3\w to jump 3 words forward.

The only trouble I've thought of is that it doesn't offer exactly the same functionality of :eclipseuiaction, but so far it seems to work with the commands above. I always though that was for commands which show some kind of pop-up.

This code could be merged with master without too much trouble as it's passive until you trigger a <Plug> mapping whose id happens to start with (eclipse-motion:, though I figured I'd best present this first seeing how it has no documentation yet.

albertdev added some commits Mar 3, 2016

Allow RemappedKeyStroke to be unwrapped
For plugs we need the delegate to acces the plug id.
Introduce plug states for commands, motions, textobjects
These will listen to <Plug>(eclipse:cmdid), <Plug>(eclipse-motion:cmdid)
and <Plug>(eclipse-textobj:cmdid) so that Eclipse motions can be used
with operators.

The user should be aware that the selection will be reset after a
Eclipse command plug has stopped running. If Vrapper should remain in
visual mode, the user should use an eclipse-textobj: plug mapping.
Handle count value outside of EclipseCommand.doIt(..)
EclipseCommand would do nothing with the count value (repeated commands
are actually executed by MultipleExecutionCommand) and other code would
nearly always pass 0 or 1.

Moving this code outside guarantees that it gets executed in the motion
or textobject code.
Eclipse textobject sets selection from normal mode, fix result range
Vim has only a few textobjects which activate visual mode from normal
mode, the (eclipse-textobj:<cmdid>) plug is another Vrapper-specific
case.
@albertdev

This comment has been minimized.

Show comment
Hide comment
@albertdev

albertdev Sep 28, 2016

Contributor

No comments, not even from @psporysz?

If @keforbes agrees then I'd just merge it to master and include it in the next release.

Contributor

albertdev commented Sep 28, 2016

No comments, not even from @psporysz?

If @keforbes agrees then I'd just merge it to master and include it in the next release.

@keforbes

This comment has been minimized.

Show comment
Hide comment
@keforbes

keforbes Sep 28, 2016

Contributor

That's fine with me, we can merge it in.

Quick question though. You said the functionality isn't exactly the same as :eclipseuiaction but does this change behave the same as :eclipseaction? I don't think we would deprecate the :eclipseaction command, I'm just curious if the documentation needs to specify any differences.

Contributor

keforbes commented Sep 28, 2016

That's fine with me, we can merge it in.

Quick question though. You said the functionality isn't exactly the same as :eclipseuiaction but does this change behave the same as :eclipseaction? I don't think we would deprecate the :eclipseaction command, I'm just curious if the documentation needs to specify any differences.

@psporysz

This comment has been minimized.

Show comment
Hide comment
@psporysz

psporysz Sep 28, 2016

Contributor

I haven't had time to play with it. I am fine too.

Contributor

psporysz commented Sep 28, 2016

I haven't had time to play with it. I am fine too.

@keforbes keforbes merged commit 787ada7 into vrapper:master Sep 29, 2016

@keforbes keforbes referenced this pull request Sep 29, 2016

Closed

Expand Region plugin #752

@albertdev

This comment has been minimized.

Show comment
Hide comment
@albertdev

albertdev Sep 29, 2016

Contributor

Quick question though. You said the functionality isn't exactly the same as :eclipseuiaction but does this change behave the same as :eclipseaction? I don't think we would deprecate the :eclipseaction command, I'm just curious if the documentation needs to specify any differences.

It behaves the same as a "simple" :eclipseaction except that it should work correctly in all modes, and it's just far easier to map to normal, visual or insert mode.

Another difference in :eclipseaction is that the command line command also supports extra arguments whereas these plugs don't.

Either way they were meant be part of some support infrastructure intent on solving #17 (our oldest open feature request!) and #133, but my motivation to complete that has been below zero since I now rarely use Eclipse at work.

Contributor

albertdev commented Sep 29, 2016

Quick question though. You said the functionality isn't exactly the same as :eclipseuiaction but does this change behave the same as :eclipseaction? I don't think we would deprecate the :eclipseaction command, I'm just curious if the documentation needs to specify any differences.

It behaves the same as a "simple" :eclipseaction except that it should work correctly in all modes, and it's just far easier to map to normal, visual or insert mode.

Another difference in :eclipseaction is that the command line command also supports extra arguments whereas these plugs don't.

Either way they were meant be part of some support infrastructure intent on solving #17 (our oldest open feature request!) and #133, but my motivation to complete that has been below zero since I now rarely use Eclipse at work.

@albertdev albertdev deleted the albertdev:TODO-eclipse-cmd-plugs branch Aug 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment