Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit be9fb47

Browse files
committed
[node plugin] Fix returning object completions
Issue angelozerr#430
1 parent 2f8133a commit be9fb47

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plugin/node.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,12 @@
194194
start: tern.outputPos(query, file, argNode.start),
195195
end: tern.outputPos(query, file, wordEnd),
196196
isProperty: false,
197-
completions: completions.map(function(name) {
198-
var string = JSON.stringify(name);
197+
completions: completions.map(function(rec) {
198+
var string = JSON.stringify(typeof rec == "string" ? rec : rec.name);
199199
if (quote == "'") string = quote + string.slice(1, string.length -1).replace(/'/g, "\\'") + quote;
200-
return string;
200+
if (typeof rec == "string") return string;
201+
rec.name = string;
202+
return rec;
201203
})
202204
};
203205
}

0 commit comments

Comments
 (0)