@@ -287,9 +287,11 @@ define(function (require, exports, module) {
287287 * Registers a new jump-to-definition provider. When jump-to-definition is invoked each
288288 * registered provider is asked if it wants to provide jump-to-definition results, given
289289 * the current editor and cursor location.
290+ *
290291 * @param {function(!Editor, !{line:number, ch:number}):?$.Promise } provider
291- * The provider returns a promise that will be resolved with jump-to-definition results, or
292- * returns null to indicate the provider doesn't want to respond to this case.
292+ * The provider returns a promise that is resolved whenever it's done handling the operation,
293+ * or returns null to indicate the provider doesn't want to respond to this case. It is entirely
294+ * up to the provider to open the file containing the definition, select the appropriate text, etc.
293295 */
294296 function registerJumpToDefProvider ( provider ) {
295297 _jumpToDefProviders . push ( provider ) ;
@@ -953,24 +955,25 @@ define(function (require, exports, module) {
953955
954956 /**
955957 * Asynchronously asks providers to handle jump-to-definition.
956- * @return {!Promise } null if no appropriate provider exists. Else, returns a promise
957- * which is resolved by adjusting the editor selection to the requested definition .
958+ * @return {!Promise } Resolved when the provider signals that it's done; rejected if no
959+ * provider responded or the provider that responded failed .
958960 */
959961 function _doJumpToDef ( ) {
960962 var providers = _jumpToDefProviders ;
961963 var promise ,
962964 i ,
963965 result = new $ . Deferred ( ) ;
964966
965- if ( _currentEditor ) {
966- // main editor has focus
967+ var editor = getActiveEditor ( ) ;
968+ if ( editor ) {
969+ var pos = editor . getCursorPos ( ) ;
967970
968971 PerfUtils . markStart ( PerfUtils . JUMP_TO_DEFINITION ) ;
969972
970973 // Run through providers until one responds
971974 for ( i = 0 ; i < providers . length && ! promise ; i ++ ) {
972975 var provider = providers [ i ] ;
973- promise = provider ( ) ;
976+ promise = provider ( editor , pos ) ;
974977 }
975978
976979 // Will one of them will provide a result?
@@ -1056,4 +1059,4 @@ define(function (require, exports, module) {
10561059 exports . notifyPathDeleted = notifyPathDeleted ;
10571060 exports . closeCustomViewer = closeCustomViewer ;
10581061 exports . showingCustomViewerForPath = showingCustomViewerForPath ;
1059- } ) ;
1062+ } ) ;
0 commit comments