(varName)
| 369 | |
| 370 | function jumpToDef(ts, cm) { |
| 371 | function inner(varName) { |
| 372 | var req = {type: "definition", variable: varName || null}; |
| 373 | var doc = findDoc(ts, cm.getDoc()); |
| 374 | ts.server.request(buildRequest(ts, doc, req), function(error, data) { |
| 375 | if (error) return showError(ts, cm, error); |
| 376 | if (!data.file && data.url) { window.open(data.url); return; } |
| 377 | |
| 378 | if (data.file) { |
| 379 | var localDoc = ts.docs[data.file], found; |
| 380 | if (localDoc && (found = findContext(localDoc.doc, data))) { |
| 381 | ts.jumpStack.push({file: doc.name, |
| 382 | start: cm.getCursor("from"), |
| 383 | end: cm.getCursor("to")}); |
| 384 | moveTo(ts, doc, localDoc, found.start, found.end); |
| 385 | return; |
| 386 | } |
| 387 | } |
| 388 | showError(ts, cm, "Could not find a definition."); |
| 389 | }); |
| 390 | } |
| 391 | |
| 392 | if (!atInterestingExpression(cm)) |
| 393 | dialog(cm, "Jump to variable", function(name) { if (name) inner(name); }); |
no test coverage detected