Skip to content

Filter modifiers #1008

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

Merged
merged 11 commits into from
Oct 6, 2022
Merged

Filter modifiers #1008

merged 11 commits into from
Oct 6, 2022

Conversation

AndreasArvidsson
Copy link
Member

@AndreasArvidsson AndreasArvidsson commented Oct 4, 2022

Fixes #1005
Fixes #1006

Checklist

  • Add filter modifiers
  • "every line" should include empty and whitespace lines
  • I have added tests

Copy link
Member

@pokey pokey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super cool to see that this was actually as trivial as we hoped. Great sign. Left a couple minor comments

@pokey
Copy link
Member

pokey commented Oct 5, 2022

Ok I have an alternative idea: how about we just create a meta-modifier called "only" that can accept any scope. It tries to expand to the scope. If it fails, it returns []. If it succeeds it just returns the original target [target]. If user wants expansion as well they can chain normal scope after. So then eg we could say "take only chars" and it would give you the cursors that contain or are adjacent to a non-whitespace char, which seems more useful than "content" anyway I think

It also might be useful to have a forgiving version of containing scope. Could be a flag on either usual containing scope or on this modifier. As mentioned above it can be accomplished by chaining: "funk only funks", so maybe not that important 🤷‍♂️

Should be trivial to impl, tho will be better with plurals and proper scope handlers

But I'm hesitant to introduce the stuff here if we'll replace it with this more powerful version

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Oct 5, 2022

It is an interesting idea. Maybe we should do that in addition to the ones we have here? In some sense I think that content fits my mental image better than only characters. We can always do a follow up pr and add that if we want?

@pokey
Copy link
Member

pokey commented Oct 5, 2022

I'm just hesitant to add something to the csv if we aren't sure about it

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Oct 5, 2022

I think we should add those in addition and keep the three added here.

@pokey
Copy link
Member

pokey commented Oct 5, 2022

Let's chat tomorrow

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Oct 6, 2022

@pokey Updated. I'm still a bit hesitant if we should add the word "keep" before the default spoken form? This is really only a modifier for multiple cursors so maybe it's fine to be a bit verbose?
If you agree please go ahead and make that change otherwise I'm happy and we can merge this.

@AndreasArvidsson AndreasArvidsson merged commit d07cb99 into main Oct 6, 2022
@AndreasArvidsson AndreasArvidsson deleted the filter_modifiers branch October 6, 2022 11:56
cursorless-bot pushed a commit that referenced this pull request Oct 6, 2022
* Every line returns empty lines

* Added new filter modifiers

* Updated line tests

* Added filter tests

* updated spoken forms

* Update filter stage names

* File rename

* Refactored
thetomcraig-aya pushed a commit to thetomcraig/cursorless that referenced this pull request Mar 27, 2024
* Every line returns empty lines

* Added new filter modifiers

* Updated line tests

* Added filter tests

* updated spoken forms

* Update filter stage names

* File rename

* Refactored
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

Successfully merging this pull request may close these issues.

Add filter modifiers "next line" doesn't behave as expected with empty lines
2 participants