cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Special handling of previous/next scope when in a code block/body

Open AndreasArvidsson opened this issue 1 year ago • 0 comments

Today's behavior given is a bit awkward around nested scopes. eg

if |value == 0:
   return None
print("after")

In this scenarios saying "take next state" I would expect to select the print statement, but you actually get the return statement. This is because we yield the statements in document order and we don't skip descendant scopes.

The reason why we can't just skip the containing scope altogether is this example

if|value == 0:
   |
   return None
print("after")

Here the if statement is containing so the statement after containing would be print, but in this scenario I definitely would expect the return statement for "take next state".

One solution to this is to have specific behavior when inside of a code block/body.

AndreasArvidsson avatar Aug 04 '24 07:08 AndreasArvidsson