mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
Fixes broken autocompletion from 8bc6001d27
8bc6001d27
removed autocompletions of
non-enumerable own-properties in trying to add enumerable prototype
properties to the autocompletions. This commit adds them back and unions
them with the enumerable prototype properties.
This commit is contained in:
parent
dac24a3d8a
commit
8dcbe54e55
2 changed files with 13 additions and 9 deletions
|
@ -41,7 +41,7 @@
|
|||
};
|
||||
|
||||
completeAttribute = function(text) {
|
||||
var all, completions, key, match, obj, prefix, val;
|
||||
var all, completions, key, match, obj, possibilities, prefix, val;
|
||||
if (match = text.match(ACCESSOR)) {
|
||||
all = match[0], obj = match[1], prefix = match[2];
|
||||
try {
|
||||
|
@ -49,14 +49,14 @@
|
|||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
completions = getCompletions(prefix, (function() {
|
||||
var _results;
|
||||
_results = [];
|
||||
for (key in Object(val)) {
|
||||
_results.push(key);
|
||||
val = Object(val);
|
||||
possibilities = Object.getOwnPropertyNames(val);
|
||||
for (key in val) {
|
||||
if (~possibilities.indexOf(val)) {
|
||||
possibilities.push(key);
|
||||
}
|
||||
return _results;
|
||||
})());
|
||||
}
|
||||
completions = getCompletions(prefix, possibilities);
|
||||
return [completions, prefix];
|
||||
}
|
||||
};
|
||||
|
|
|
@ -47,7 +47,11 @@ completeAttribute = (text) ->
|
|||
val = Script.runInThisContext obj
|
||||
catch error
|
||||
return
|
||||
completions = getCompletions prefix, (key for key of Object(val))
|
||||
val = Object val
|
||||
possibilities = Object.getOwnPropertyNames val
|
||||
for key of val when ~possibilities.indexOf val
|
||||
possibilities.push key
|
||||
completions = getCompletions prefix, possibilities
|
||||
[completions, prefix]
|
||||
|
||||
# Attempt to autocomplete an in-scope free variable: `one`.
|
||||
|
|
Loading…
Reference in a new issue