cursorless/docs
Pokey Rule 9f79e1cb2c
Support "every line air past bat" (#1462)
We also support fancier constructs like the following:

- "every line block air past bat"
- "every line air past block bat"
- "every line past bat"
- "every line past block bat"

The approach is to detect ranges of the form `"every <scope> <target>
past <target>"` and to turn them into a special range target, distinct
from `"continuous"` or `"slice"`. We remove the `"every <scope>"`
modifier as well because that's done after we construct the range.

The reason we need a special range target is that exclusion needs to be
smart to handle scopes whose domain is larger than their content range

We also add slight special casing for line targets so that when you're
at the beginning / end of a line, that line is considered part of the
range

## Checklist

- [x] Only expand to containing scope if the given end is excluded, eg
expand end target if "until". Might need to tweak construction of ranges
so that each side is responsible for exclusion to make "every token
until line bat" work, because otherwise it gets downgraded so we won't
actually skip the right thing. eg try "every token air past state bat"
if "bat" is in the middle of the statement.
- [x] Add tests for above examples
- [x] Handle case where one side is not in a scope
- [x] Handle case where one side is in a scope but you don't want it to
jump to parent (eg "take every state past bat" when we're inside a
function but between statements)
- [x] Add test for "every line air until bat"
- [x] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [x] I have updated the
[docs](https://github.com/cursorless-dev/cursorless/tree/main/docs) and
[cheatsheet](https://github.com/cursorless-dev/cursorless/tree/main/cursorless-talon/src/cheatsheet)
- [x] I have not broken the cheatsheet
2023-05-15 14:44:35 +00:00
..
contributing Support adding languages using only queries (#1449) 2023-05-11 16:08:53 +00:00
user Support "every line air past bat" (#1462) 2023-05-15 14:44:35 +00:00