-
-
Notifications
You must be signed in to change notification settings - Fork 89
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 here
Approach
- Add a
scopeType
field toTarget
- Try to expand to that
scopeType
when we find a match, just as we do for token and word targets ininstance
today - If 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 info
josharian
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request