cursorless
cursorless copied to clipboard
Add `"subject"` scope type
- [ ] We'll begin by introducing the scope type extension side
- [ ] Then when we support amalgamating more granular scope types, we'll figure out how we want to roll this one up
For original discussion, see https://github.com/cursorless-dev/cursorless/issues/579#issuecomment-1161627378 for more
As I mention in #2177, "subject" is a generalisation of "condition".
huh that's kind of interesting. had never seen your if-else / switch equivalence before. repeated here for convenience
def ifThenElse(cond, ifTrue, ifFalse):
match cond:
# ^^^^ <-- "condition"
case True:
# ^^^^ <-- "pattern"
return ifTrue()
case False:
# ^^^^^ <-- "pattern"
return ifFalse()
I think I could be convinced that condition should be what's inside the parens. It visually feels like condition as well because of where it appears in the statement (at the top inside parens), which practically speaking is what matters the most 😄🦎🧠. cc/ @AndreasArvidsson
Inside the parens? Are you talking about the arguments to the function? Could you elaborate?
It should be the argument to match, right? The name in the parens is the function argument.
Letting "condition" refer to today's "subject". But not totally convinced
I was never a fan of subject and would be fine with just using condition there as well.
Wait, was subject actually implemented?
Yes but as a private scope
subject, private.switchStatementSubject
https://github.com/cursorless-dev/cursorless/pull/1148