TypeScript
TypeScript copied to clipboard
fix(51225): Go-to-definition on case or default should jump to the containing switch statement if available.
Fixes #51225
@microsoft-github-policy-service agree
Can you add one more test?
switch (null) {
case null:
export /*start*/default 123;
}
Validate that it doesn't jump to the switch
statement.
/////*c*/export default { [|/*a*/case|] };
////[|/*b*/default|];
Is it normal that b and goes to c? This is how it works now and looks like a bug. It is expected that there will be no go to anywhere.
It's questionable, but I wouldn't get hung up on fixing that specific case.
@sheetalkamat I changed contextSpan to keyword + expression, but i can't find any examples for testing contextSpan with fourslash
Good to go @sheetalkamat?
Any progress? @sheetalkamat
@typescript-bot pack this
I am working on framework to test contextSpan with goto def which we should merge and then rebase this PR so its clearer on what is the context that is being set for contextSpan. Will link PR here once i have it ready
@sviat9440 #52576 is up and once that is merged you should be able to update your PR with the baselines that verify context,
Having said that, i completely mis-read context Span to be first line of declaration. It is infact the complete declaration. With that in mind i think your earlier change of having contextSpan
as complete switch statement was correct and you would want to go back to that behavior. Sorry for misdirecting you on that one.
#52576 is merged. Feel free to merge changes from main and baseline