Skip to content

Added support for previous and next containing scope type #960

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 76 commits into from
Oct 1, 2022

Conversation

AndreasArvidsson
Copy link
Member

@AndreasArvidsson AndreasArvidsson commented Sep 14, 2022

"take next funk"
"change previous state"

For now you can't use this when not in the current containing scope. This is a limitation of our current implication of every. I still feel it could be really useful.

Fixes #982

Checklist

@AndreasArvidsson
Copy link
Member Author

AndreasArvidsson commented Sep 22, 2022

@phillco @auscompgeek I have now updated previous/next to use existing ordinal range modifier. For now I have removed all changes Talon side and is going to do a follow up pr regarding #13 where I'm going to implement all the grammar and thoroughly test these.

I think we need a discussion about how to handle relative sub tokens with regards to explicit range. For now relative is not enabled for sub tokens.

@AndreasArvidsson
Copy link
Member Author

@pokey Modifiers are renamed

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.

Ok I pushed a bunch of minor changes, and was hoping to just do everything myself, but ran into an issue with the logic for relative scopes, and I think it may require a rethinking of the way you handle relative scopes, so I'm going to put this one back into your court

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.

Ok I made a bunch of minor changes, and left one question. Lmk if you have a problem with any of the changes, and curious to hear your thoughts on my comment, but otherwise good to go!

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.

Ok I think this is good to go! I added a bunch of tests and did some cleanup. Have a quick look before you merge to make sure you're happy

Fwiw I made a super basic grammar for "two funk" so I could easily add tests; doesn't have pluralisation tho so I'm not going to merge it. Here it is tho in case helpful

@AndreasArvidsson
Copy link
Member Author

I think it looks good :)

@AndreasArvidsson AndreasArvidsson merged commit 6f71e72 into main Oct 1, 2022
@AndreasArvidsson AndreasArvidsson deleted the previousNextContainingScope branch October 1, 2022 20:58
cursorless-bot pushed a commit that referenced this pull request Oct 1, 2022
* Added support for previous and next containing scope type

* Added tests

* Reverse changes

* Reuse ordinal range for previous/next modifier

* Use correct relative index

* Added word and character as proper scope types

* Select correct target

* Always use token range

* Cleanup

* Clean up

* New implementation of ordinal stage

* Updated tests

* Started working on migration

* Made all tests pass

* Added comment

* Clean up

* Added range modifier

* Added tests for scope type word and character

* Clean up

* Created ordinal capture

* Added ordinal items tests

* cleanup

* Added previous/next capture

* Clean up

* Update cursorless-talon/src/modifiers/ordinals.py

Co-authored-by: Pokey Rule <[email protected]>

* Use if statement instead of attribute error

* Added index file

* Update src/processTargets/processTargets.ts

Co-authored-by: Pokey Rule <[email protected]>

* Update src/typings/targetDescriptor.types.ts

Co-authored-by: Pokey Rule <[email protected]>

* Update src/typings/targetDescriptor.types.ts

Co-authored-by: Pokey Rule <[email protected]>

* Update src/typings/targetDescriptor.types.ts

Co-authored-by: Pokey Rule <[email protected]>

* cleanup

* Added tests

* Clean up types

* Clean up

* Added tests

* Clean up

* Clean up import

* Clean up

* Move ordinal stages into own directory

* Prefer to take scopes to the right

* Added additional word tests

* Made migration for line number mark

* Fixed correct type

* Update grapheme regex

* Added additional tests

* rename

* Use name mark

* Updated modifier names

* Split ordinal and relative scope python files

* `lineType` => `lineNumberType`

* Tweak token grapheme splitter

* Rename variable

* Clarify duplicate range stage names

* Tweaks to relative scope stage

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added support for non containing relative scope

* More clean up to relative scope

* Rename

* Reduce nesting

* Tweaks to sub token stage

* Doc strings

* More tweaks to RelativeScopeStage

* Add comment

* Add comments

* Improve error message

* Add a bunch of tests

Co-authored-by: Pokey Rule <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@pokey pokey mentioned this pull request Oct 2, 2022
1 task
thetomcraig-aya pushed a commit to thetomcraig/cursorless that referenced this pull request Mar 27, 2024
…-dev#960)

* Added support for previous and next containing scope type

* Added tests

* Reverse changes

* Reuse ordinal range for previous/next modifier

* Use correct relative index

* Added word and character as proper scope types

* Select correct target

* Always use token range

* Cleanup

* Clean up

* New implementation of ordinal stage

* Updated tests

* Started working on migration

* Made all tests pass

* Added comment

* Clean up

* Added range modifier

* Added tests for scope type word and character

* Clean up

* Created ordinal capture

* Added ordinal items tests

* cleanup

* Added previous/next capture

* Clean up

* Update cursorless-talon/src/modifiers/ordinals.py

Co-authored-by: Pokey Rule <[email protected]>

* Use if statement instead of attribute error

* Added index file

* Update src/processTargets/processTargets.ts

Co-authored-by: Pokey Rule <[email protected]>

* Update src/typings/targetDescriptor.types.ts

Co-authored-by: Pokey Rule <[email protected]>

* Update src/typings/targetDescriptor.types.ts

Co-authored-by: Pokey Rule <[email protected]>

* Update src/typings/targetDescriptor.types.ts

Co-authored-by: Pokey Rule <[email protected]>

* cleanup

* Added tests

* Clean up types

* Clean up

* Added tests

* Clean up

* Clean up import

* Clean up

* Move ordinal stages into own directory

* Prefer to take scopes to the right

* Added additional word tests

* Made migration for line number mark

* Fixed correct type

* Update grapheme regex

* Added additional tests

* rename

* Use name mark

* Updated modifier names

* Split ordinal and relative scope python files

* `lineType` => `lineNumberType`

* Tweak token grapheme splitter

* Rename variable

* Clarify duplicate range stage names

* Tweaks to relative scope stage

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added support for non containing relative scope

* More clean up to relative scope

* Rename

* Reduce nesting

* Tweaks to sub token stage

* Doc strings

* More tweaks to RelativeScopeStage

* Add comment

* Add comments

* Improve error message

* Add a bunch of tests

Co-authored-by: Pokey Rule <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

Support simple relative and absolute ordinal scope modifiers
3 participants