From: Jay Freeman (saurik) Date: Mon, 7 Dec 2015 10:35:12 +0000 (-0800) Subject: Support tab completion on unenumerable properties. X-Git-Tag: v0.9.590~237 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/24d9135d305ba6ad76dde5bb36038dd1912fd104?ds=sidebyside;hp=ca6a1b2b2dce57a7ad9e11bdd3649f00ca855a15 Support tab completion on unenumerable properties. --- diff --git a/Complete.cpp b/Complete.cpp index c81f90e..6ce6671 100644 --- a/Complete.cpp +++ b/Complete.cpp @@ -101,9 +101,20 @@ _visible char **CYComplete(const char *word, const std::string &line, CYUTF8Stri " var before = prefix.length;\n" " prefix += word;\n" " var entire = prefix.length;\n" - " for (var name in object)\n" - " if (name.substring(0, entire) == prefix)\n" - " names.push(name.substr(before));\n" + " if (false) {\n" + " for (var name in object)\n" + " if (name.substring(0, entire) == prefix)\n" + " names.push(name.substr(before));\n" + " } else do {\n" + " try {\n" + " var local = Object.getOwnPropertyNames(object);\n" + " } catch (e) {\n" + " continue;\n" + " }\n" + " for (var name of local)\n" + " if (name.substring(0, entire) == prefix)\n" + " names.push(name.substr(before));\n" + " } while (object = typeof object === 'object' ? Object.getPrototypeOf(object) : object.__proto__);\n" " return names;\n" " }\n" ), expression, $S(begin.c_str()), $S(word))));