Commit b97f314
Added scope type for
Inside/interior today is a modifier and will stay so in the future, but
we are also introducing interior as a scope type. This will allow us to
do `"take inside"` when on a if statement, python function and so on.
It now takes the closest of the nearest tree-sitter interior _or_
surrounding pair. This is most useful for Python; in other languages
with {} statement-blocks, the braces would already be easy to target,
but now "take inside" behaves intuitively there as well.
The scm syntax `@scope.interior` have been replaced by `@interior` as
its own scope type.
Fixes #1046
## Checklist
- [x] I have added
[tests](https://www.cursorless.org/docs/contributing/test-case-recorder/)
- [/] 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)
- [/] I have not broken the cheatsheet
## Release notes
You can now use "inside" to refer to the inside body of a language scope
(function, if statement, etc). This is especially useful for Python,
because previously you had to think about what scope you were targeting
-- "take inside" now just works.
It also works nicely for targeting the inside of C-style statements that
don't have `{}` braces, like single line conditionals or loops.
In Python, this also means that you can now target the inside of the
function ("take inside") even while the cursor is in a related location
(such as in its name). Note that this behavior currently only exists for
Python; we plan to port it to other languages as well since it is
useful.
---------
Co-authored-by: Phil Cohen <[email protected]>"inside" (#2776)1 parent 1d7c9bd commit b97f314
1 file changed
+1
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
| |||
0 commit comments