Skip to content

Implement head and tail equivalent modifier for other scopes #623

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

Closed
david-tejada opened this issue Mar 25, 2022 · 11 comments · Fixed by #708
Closed

Implement head and tail equivalent modifier for other scopes #623

david-tejada opened this issue Mar 25, 2022 · 11 comments · Fixed by #708
Assignees
Labels
enhancement New feature or request

Comments

@david-tejada
Copy link

david-tejada commented Mar 25, 2022

I find head and tail very useful and I think a similar modifier for other scope types would be useful, especially for "file". We could say eg "file head", "funk head", etc

@david-tejada david-tejada changed the title Implement head and tail equivalent for modifier for start of/end of file Implement head and tail equivalent for modifier for start of/end of file Mar 25, 2022
@david-tejada david-tejada changed the title Implement head and tail equivalent for modifier for start of/end of file Implement head and tail equivalent for modifier for start of / end of file Mar 25, 2022
@david-tejada david-tejada changed the title Implement head and tail equivalent for modifier for start of / end of file Implement head and tail equivalent modifier for start of / end of file Mar 25, 2022
@pokey pokey changed the title Implement head and tail equivalent modifier for start of / end of file Implement head and tail equivalent modifier for other scopes May 29, 2022
@pokey pokey added the enhancement New feature or request label May 29, 2022
@pokey
Copy link
Member

pokey commented May 29, 2022

Sounds great! One question: I wonder what we do about ambiguity, eg "file head" could also be interpreted as "file" <= "head"?

@david-tejada
Copy link
Author

I'm not sure I understand the ambiguity, would you mind elaborating?

@AndreasArvidsson
Copy link
Member

AndreasArvidsson commented May 29, 2022

I would still recommend head file since today we have head air. That also helps with ambiguity for us that has head and tail a separate commands.

@pokey
Copy link
Member

pokey commented May 29, 2022

I don't feel strongly between "head file" vs "file head", but I'm not sure I see why one is less ambiguous than the other. "file" and "head" are both modifiers, so no matter which order we put them in there will be ambiguity

@pokey
Copy link
Member

pokey commented May 29, 2022

I'm not sure I understand the ambiguity, would you mind elaborating?

In the version of Cursorless that will be released soon (#672), you'll be able to chain arbitrary modifiers, so eg "every line funk air" will select every line in the function containing "air".

Currently, "file" and "head" are both modifiers, so if we introduce a modifier called "file head" that selects the part of file before the mark, then when you say "take file head air", that could be interpreted as first selecting the first part of the line "air", and then selecting the file containing it

@david-tejada
Copy link
Author

I see the issue now. Thanks for the clarification. I suppose you don't have a way to disambiguate. Something like "file head" always means from the start of the file to the token, because why would anybody include head when they want to refer to the file instead of just using the token?

@pokey
Copy link
Member

pokey commented May 30, 2022

Yes I don't see the ambiguity as a particularly big problem. I could see possibly wanting "token head" to mean extend to start of line then expand to containing token (ie if my cursor started in the middle of a token), tho in that case I could say "token line head" to disambiguate, or actually "head token" should work as well

The real question is whether talon will prefer to parse "file head" as one modifier rather than splitting it. My guess is yes, but worth checking as we try to implement

@AndreasArvidsson
Copy link
Member

We could also update the pipeline so each stage has access to the previous instance of the target and in that case we could just use head as a stand alone modifier.

@pokey
Copy link
Member

pokey commented May 30, 2022

That's an interesting idea, and actually could be useful for some of the next-gen inference stuff, because for example, trying to parse "every line air between bat" is pretty awkward to do otherwise

@AndreasArvidsson
Copy link
Member

Then I suggest we go that route instead :)

@AndreasArvidsson AndreasArvidsson self-assigned this May 31, 2022
@AndreasArvidsson
Copy link
Member

@pokey This is a working pr based upon our new object oriented targets
#708

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants