Skip to content
Snippets Groups Projects
Commit bc026f1b authored by Se-Won Kim's avatar Se-Won Kim Committed by Marijn Haverbeke
Browse files

[tern addon] Use correct primary when selecting variables

parent 3ef42f71
No related branches found
No related tags found
No related merge requests found
......@@ -466,12 +466,13 @@
ts.request(cm, {type: "refs"}, function(error, data) {
if (error) return showError(ts, cm, error);
var ranges = [], cur = 0;
var curPos = cm.getCursor();
for (var i = 0; i < data.refs.length; i++) {
var ref = data.refs[i];
if (ref.file == name) {
ranges.push({anchor: ref.start, head: ref.end});
if (cmpPos(cur, ref.start) >= 0 && cmpPos(cur, ref.end) <= 0)
cur = ranges.length - 1;
if (cmpPos(curPos, ref.start) >= 0 && cmpPos(curPos, ref.end) <= 0)
cur = i;
}
}
cm.setSelections(ranges, cur);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment