@@ -32,6 +32,13 @@ namespace ts.GoToDefinition {
32
32
return functionDeclaration ? [ createDefinitionFromSignatureDeclaration ( typeChecker , functionDeclaration ) ] : undefined ;
33
33
}
34
34
35
+ if ( node . kind === SyntaxKind . CaseKeyword || node . kind === SyntaxKind . DefaultKeyword ) {
36
+ const switchStatement = findAncestor ( node . parent , n => isExportAssignment ( n ) ? "quit" : isSwitchStatement ( n ) ) as SwitchStatement | undefined ;
37
+ if ( switchStatement ) {
38
+ return [ createDefinitionInfoFromNode ( switchStatement , "switch" ) ] ;
39
+ }
40
+ }
41
+
35
42
if ( isStaticModifier ( node ) && isClassStaticBlockDeclaration ( node . parent ) ) {
36
43
const classDecl = node . parent . parent ;
37
44
const { symbol, failedAliasResolution } = getSymbol ( classDecl , typeChecker , stopAtAlias ) ;
@@ -510,4 +517,21 @@ namespace ts.GoToDefinition {
510
517
return false ;
511
518
}
512
519
}
520
+
521
+ function createDefinitionInfoFromNode ( node : Node , name : string ) : DefinitionInfo {
522
+ const sourceFile = node . getSourceFile ( ) ;
523
+ return {
524
+ fileName : sourceFile . fileName ,
525
+ textSpan : createTextSpanFromNode ( node , sourceFile ) ,
526
+ kind : ScriptElementKind . label ,
527
+ name,
528
+ containerKind : ScriptElementKind . unknown ,
529
+ containerName : "" ,
530
+ contextSpan : createTextSpanFromNode ( node , sourceFile ) ,
531
+ isLocal : false ,
532
+ isAmbient : false ,
533
+ unverified : false ,
534
+ failedAliasResolution : undefined ,
535
+ } ;
536
+ }
513
537
}
0 commit comments