From 24d9135d305ba6ad76dde5bb36038dd1912fd104 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 7 Dec 2015 02:35:12 -0800 Subject: [PATCH 1/1] Support tab completion on unenumerable properties. --- Complete.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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)))); -- 2.47.2