TypeScript
TypeScript copied to clipboard
Go-to-definition on `case` or `default` should jump to the containing `switch` statement if available.
/*END*/switch (null) {
/*START*/case null: break;
}
/*END*/switch (null) {
/*START*/default: break;
}
Those should work.
The following should not have issues.
export /*a*/default {}
export default { /*a*/case }
/*b*/default;
/*c*/case 42;
If you try to go to the beginning of the SwitchStatement, there is a small problem: The position after the previous expression (including spaces, line breaks, and so on) is considered to be the beginning of the SwitchStatement
TestCase:
//// switch (null) {
//// case null: break;
//// }
////
//// /*end*/switch (null) {
//// [|/*start*/case|] null: break;
//// }
Result:
// @Filename: /tests/cases/fourslash/goToDefinitionSwitch4.ts
switch (null) {
case null: break;
}/*ACTUAL*/
/*EXPECTED*/switch (null) {
case null: break;
}
I suggest going to the beginning of the block and not to the beginning of the SwitchStatement
//// switch (null) {
//// case null: break;
//// }
////
//// switch (null) /*end*/{
//// [|/*start*/case|] null: break;
//// }
Or:
//// switch (null) {
//// case null: break;
//// }
////
//// switch (/*end*/null) {
//// [|/*start*/case|] null: break;
//// }
close this issue if it fixed @DanielRosenwasser
is the issue fixed?