cursorless
cursorless copied to clipboard
Fix `"grand grand <scope>"` on scope boundaries
I believe this approach will break down if cursor is between adjacent scopes. Let's say scopes look like the following (document text is `0123`):
0123
a: -
b: -
c: --
d: ---
And cursor is between 2 and 3 and scope preference breaks left, so containing scope is a. If you say "grand grand scope", you will get b, when you should get d. I think you need to keep a currentScope, initialize it to the original containing scope, filter out scopes that are not a parent of the current scope, and keep updating it and increment ancestor count each time you find a matching scope. Not sure if that makes sense?
Originally posted by @pokey in https://github.com/cursorless-dev/cursorless/pull/2130#discussion_r1425439095