You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discovered a small issue in tern when files are not loaded in order. Jump to definition gives the right position but wrong filename. Found it and fixed it but no time to clone && make a pull request for something so small :). Thanks y'all for good software.
The issue crops when you have files like;
a.js
var c;
function b(a){
c = a
}
b.js
b({hello:'hi'})
c.js
c.hello
If files are loaded in this order c.js>b.js>a.js, jumpToDef on 'hello' takes you to a.js.
Here's my ignorant quick fix.
if (span && span.node) { // refers to a loaded file
var spanFile = span.node.sourceFile || srv.fileMap[span.origin];
var start = outputPos(query, spanFile, span.node.start), end = outputPos(query, spanFile, span.node.end);
result.start = start; result.end = end;
---result.file = span.origin
+++result.file = (spanFile && spanFile.name)||span.origin;
var cxStart = Math.max(0, span.node.start - 50);
result.contextOffset = span.node.start - cxStart;
result.context = spanFile.text.slice(cxStart, cxStart + 50);
} else if (span) { // external
result.file = span.origin;
storeSpan(srv, query, span, result);
}
The text was updated successfully, but these errors were encountered:
Discovered a small issue in tern when files are not loaded in order. Jump to definition gives the right position but wrong filename. Found it and fixed it but no time to clone && make a pull request for something so small :). Thanks y'all for good software.
The issue crops when you have files like;
a.js
b.js
c.js
If files are loaded in this order c.js>b.js>a.js, jumpToDef on 'hello' takes you to a.js.
Here's my ignorant quick fix.
The text was updated successfully, but these errors were encountered: