nl_tokens: / Goto definition
pl_tokens: function getDefinitionAtPosition ( fileName , position ) { synchronizeHostData ( ) ; var sourceFile = getValidSourceFile ( fileName ) ; var node = <mask> . getTouchingPropertyName ( sourceFile , position ) ; if ( ! node ) { return undefined ; } // Labels if ( isJumpStatementTarget ( node ) ) { var labelName = node . text ; var label = getTargetLabel ( node . parent , node . text ) ; return label ? [ createDefinitionInfo ( label , ScriptElementKind . label , labelName , /*containerName*/ undefined ) ] : undefined ; } /// Triple slash reference comments var comment = ts . forEach ( sourceFile . referencedFiles , function ( r ) { return ( r . pos <= position && position < r . end ) ? r : undefined ; } ) ; if ( comment ) { var referenceFile = ts . tryResolveScriptReference ( program , sourceFile , comment ) ; if ( referenceFile ) { return [ { fileName : referenceFile . fileName , textSpan : ts . createTextSpanFromBounds ( 0 , 0 ) , kind : ScriptElementKind . scriptElement , name : comment . fileName , containerName : undefined , containerKind : undefined } ] ; } return undefined ; } var typeChecker = program . getTypeChecker ( ) ; var symbol = typeChecker . getSymbolAtLocation ( node ) ; // Could not find a symbol e.g. node is string or number keyword, // or the symbol was an internal symbol and does not have a declaration e.g. undefined symbol if ( ! symbol ) { return undefined ; } // If this is an alias, and the request came at the declaration location // get the aliased symbol instead. This allows for goto def on an import e.g. //   import {A, B} from "mod"; // to jump to the implementation directly. if ( symbol . flags & 8388608 /* Alias */ ) { var declaration = symbol . declarations [ 0 ] ; if ( node . kind === 69 /* Identifier */ && node . parent === declaration ) { symbol = typeChecker . getAliasedSymbol ( symbol ) ; } } // Because name in short-hand property assignment has two different meanings: property name and property value, // using go-to-definition at such position should go to the variable declaration of the property value rather than // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. if ( node . parent . kind === 246 /* ShorthandPropertyAssignment */ ) { var shorthandSymbol = typeChecker . getShorthandAssignmentValueSymbol ( symbol . valueDeclaration ) ; if ( ! shorthandSymbol ) { return [ ] ; } var shorthandDeclarations = shorthandSymbol . getDeclarations ( ) ; var shorthandSymbolKind = getSymbolKind ( shorthandSymbol , node ) ; var shorthandSymbolName = typeChecker . symbolToString ( shorthandSymbol ) ; var shorthandContainerName = typeChecker . symbolToString ( symbol . parent , node ) ; return ts . map ( shorthandDeclarations , function ( declaration ) { return createDefinitionInfo ( declaration , shorthandSymbolKind , shorthandSymbolName , shorthandContainerName ) ; } ) ; } return getDefinitionFromSymbol ( symbol , node ) ; }