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

Why is expand-to-line disabled? #64

Closed
russelldavis opened this issue Apr 12, 2016 · 7 comments
Closed

Why is expand-to-line disabled? #64

russelldavis opened this issue Apr 12, 2016 · 7 comments

Comments

@russelldavis
Copy link

I was trying to figure out why the selection doesn't expand to the full line, and tracked it down to this commit: eab9e3d. Why was that commented out, and would you be open to re-enabling it?

@r-stein
Copy link
Collaborator

r-stein commented Apr 12, 2016

I would assume the reason for this is, that expand to line can break semantical expansions. For example consider the following code (where | is the cursor):

def foo(bar1, bar2, bar3, |bar4,
        bar5, bar6, bar7):
    ...

If we use expand to line this would expand outside the parens, which is not the desired behavior for this case.

However you could checkout and try out #59, which solves this issue using sorted closest expansions. I.e. do both expansions and take the expansion, which is inside the other. If they are different take the first one (expand to parens).

I would appreciate feedback and problems for that PR.

@aronwoost
Copy link
Owner

Yes, it was causing trouble with other expansion strategies. Also I considered it not-so-important for the typical use case (= my usage). However, I understand that expand-to-line might be super important for some languages.

What language are you using @russelldavis?

@russelldavis
Copy link
Author

I'm mainly using Ruby at the moment, but it's problematic for other languages as well. For example, with this line in javascript:

var fs = require('fs');

Starting on either side of the =, the region stops expanding once it hits the =.

@r-stein, that sounds like a great solution.

@aronwoost
Copy link
Owner

You can use cmd-L to select line.

@russelldavis
Copy link
Author

Of course. You can also use cmd-D to select a word. That doesn't mean this plugin should stop selecting words. :)

@aronwoost
Copy link
Owner

Sure, I just wanted to provide an alternative.

It all started with cmd-D, right? 😃

@russelldavis
Copy link
Author

Closing out old issues I've filed that have gone inactive.

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

3 participants