Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SidewaysJump* little issues #14

Open
andreiglingeanu opened this issue Oct 11, 2015 · 6 comments
Open

SidewaysJump* little issues #14

andreiglingeanu opened this issue Oct 11, 2015 · 6 comments

Comments

@andreiglingeanu
Copy link

  1. When I have this line of code (cursor is ^):
= f.text_field :email, autofocus: true, class: "form-control", placeholder: "Email", :"ng-model"=>'email', :'ng-change'=>'detect2factorAuth()'
---^

And I execute :SidewaysJumpRight it doesn't take me to the next argument. Is this by purpose?
2)
When I have this long line of code (cursor is ^):

= f.text_field :email, autofocus: true,
                     class: "form-control", placeholder: "Email", :"ng-model"=>'email',
----------------------^
                     :'ng-change'=>'detect2factorAuth()'

And I execute :SidewaysJumpRight it also doesn't work. In this case :Sideways* also doesn't work.

I understand that this maybe is an implementation difficulty.

@AndrewRadev
Copy link
Owner

Sorry for taking a while to respond.

  1. The plugin works on arguments, which is why it expects that the cursor is on one of them. In your case, I guess you should first place your cursor on :email before jumping around arguments. This is due both to being easier to implement (it's a useful assumption that you'd be on an argument, lets me safely go backwards to search for the function beginning) and because I'm not sure how the plugin should work if it's not on an argument. For instance, moving an argument right-wise doesn't make sense, but maybe jumping does (so it jumps on the first one). I'll think about how I can fit this within the plugin, but I can't promise anything.

  2. This is definitely due to implementation difficulties. To be honest, I'd like to be able to manipulate arguments over several lines as well, but right now, sideways only works on a single line. In these cases, I use my splitjoin plugin to join lines up, move things around, and then split them back, but it has its limitations.

I would like to get this to work. I can think of a possible way to do this, but I'll have to see if it works well enough

@AndrewRadev
Copy link
Owner

I've pushed a branch called multiline, in which I've tried to get sideways to work for multiline argument lists. So far, the existing tests are passing and some simple experiments seem to work. But I'm super sure there are going to be issues in a larger file with more complicated edge cases. For instance, I'm worried whether the loop that looks for arguments would even terminate correctly on all occasions.

I'm going to use this branch for the moment and try to fix things as they pop up. I'd appreciate if you were to test it as well and let me know what breaks.

@andreiglingeanu
Copy link
Author

Very nice! I have lost access to my laptop these days. Will get in touch with some feedback in 3 days.

@andreiglingeanu
Copy link
Author

I have tested multiline branch. I covers fully my use cases. Will try to use it in my day-to-day work. Will come back with more feedback.

@AndrewRadev
Copy link
Owner

Just giving you a heads-up that I've merged the "multiline" branch into master. I had some fixes to both ones and I figured maybe it's time to just get it done anyway. It seems stable to me, although if you run into bugs, let me know.

This covers point 2 on your list, and I don't think I'll be able to do anything about point 1 for now. Still, I don't mind leaving the issue open for a while. I plan to revisit old issues whenever I can and I might figure something out in the future.

@andreiglingeanu
Copy link
Author

Great, thank you 👍

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

No branches or pull requests

2 participants