mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Fixes #2280 -- add enumerable prototypal properties to autocompletion.
This commit is contained in:
parent
e433098eb2
commit
8bc6001d27
2 changed files with 10 additions and 3 deletions
|
@ -41,7 +41,7 @@
|
|||
};
|
||||
|
||||
completeAttribute = function(text) {
|
||||
var all, completions, match, obj, prefix, val;
|
||||
var all, completions, key, match, obj, prefix, val;
|
||||
if (match = text.match(ACCESSOR)) {
|
||||
all = match[0], obj = match[1], prefix = match[2];
|
||||
try {
|
||||
|
@ -49,7 +49,14 @@
|
|||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
completions = getCompletions(prefix, Object.getOwnPropertyNames(Object(val)));
|
||||
completions = getCompletions(prefix, (function() {
|
||||
var _results;
|
||||
_results = [];
|
||||
for (key in Object(val)) {
|
||||
_results.push(key);
|
||||
}
|
||||
return _results;
|
||||
})());
|
||||
return [completions, prefix];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@ completeAttribute = (text) ->
|
|||
val = Script.runInThisContext obj
|
||||
catch error
|
||||
return
|
||||
completions = getCompletions prefix, Object.getOwnPropertyNames Object val
|
||||
completions = getCompletions prefix, (key for key of Object(val))
|
||||
[completions, prefix]
|
||||
|
||||
# Attempt to autocomplete an in-scope free variable: `one`.
|
||||
|
|
Loading…
Reference in a new issue