- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Labels
enhancementNew feature or requestNew feature or request
Description
We already do this when we detect that the input for "instance" is a token or word, but we should do it for other scopes. We should also construct a target of the right scope type. For example:
const aaa = bbb(ccc, ddd);
const eee = ccc + ddd(ccc, fff);
In this case, "chuck two instances arg cap"
should give:
const aaa = bbb(ddd);
const eee = ccc + ddd(fff);
Note how:
- It skips the
ccc
in= ccc +
because that is not an argument - It cleans up commas on both
ccc
args, because it constructs args rather than untyped targets
I do wonder if this behaviour would be surprising? Would you see that ccc
in const ccc
as an instance of the same thing?
Related:
- We should probably tackle "instance" scope should inherit hasExplicitScope / hasExplicitRange from its input #1949 while we're hereTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
Approach
- Add a
scopeType
field toTarget
Try to expand to thatscopeType
when we find a match, just as we do for token and word targets ininstance
todayIf we can expand to that scope type and it's equal to the range, return the target we expanded to, as that has the rich infoTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
josharian
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
pokey commentedon Nov 30, 2023
Another potential problem here: this behaviour will likely be quite surprising with "name". If I say "clear every instance name" as a poor-man's rename, it wouldn't work, because the other instances won't be names 🤔
I am starting to get the feeling that "name", "first token", etc should downgrade to "token" for inference / instance, as they are most often the problem children for this kinda thing. They're often just used as a convenient way to target a token, rather than a semantically rich scope. Idk
Cc/ @josharian
josharian commentedon Nov 30, 2023
I think the best way to answer that question is to play around with it a bit.
pokey commentedon Nov 30, 2023
Which question?
josharian commentedon Nov 30, 2023
Whether some scopes should be downgraded to token.
pokey commentedon Nov 30, 2023
Right yeah I think that makes sense. On the first question of whether requiring "name" to be "name" for instance, I'm quite confident that would bite me
pokey commentedon Jan 7, 2024
Update from meet-up: