Skip to content

Commit 0e28012

Browse files
committed
[show-hint addon] Fix problem with events being fired on the wrong data object
Issue ternjs/tern#200
1 parent 739cd13 commit 0e28012

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

addon/hint/show-hint.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
Completion.prototype = {
2828
close: function() {
2929
if (!this.active()) return;
30+
this.cm.state.completionActive = null;
3031

3132
if (this.widget) this.widget.close();
3233
if (this.onClose) this.onClose();
33-
this.cm.state.completionActive = null;
3434
CodeMirror.signal(this.cm, "endCompletion", this.cm);
3535
},
3636

@@ -76,12 +76,14 @@
7676

7777
function update() {
7878
if (isDone()) return;
79+
CodeMirror.signal(data, "update");
7980
if (completion.options.async)
8081
completion.getHints(completion.cm, finishUpdate, completion.options);
8182
else
8283
finishUpdate(completion.getHints(completion.cm, completion.options));
8384
}
84-
function finishUpdate(data) {
85+
function finishUpdate(data_) {
86+
data = data_;
8587
if (isDone()) return;
8688
if (!data || !data.list.length) return done();
8789
completion.widget.close();

addon/tern/tern.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
var obj = {from: from, to: to, list: completions};
184184
var tooltip = null;
185185
CodeMirror.on(obj, "close", function() { remove(tooltip); });
186+
CodeMirror.on(obj, "update", function() { remove(tooltip); });
186187
CodeMirror.on(obj, "select", function(cur, node) {
187188
remove(tooltip);
188189
var content = ts.options.completionTip ? ts.options.completionTip(cur.data) : cur.data.doc;

0 commit comments

Comments
 (0)