Closed syntaxseed closed 4 years ago
Hi can I take a shot at this?
@jxuan101 yes please! :)
When I checked the output of all elements in the set returned from the function getAllMethodNames in src/main/components/utils.js called by the help command, I noticed that custom commands are not included in the output. Could you help me understand why this might be?
For some reason, the following modifications to the getAllMethodNames function fixes this issue,
export function getAllMethodNames(obj) {
let methods = new Set();
let clone = obj;
if (Reflect.getPrototypeOf(clone)) {
let keys = Reflect.ownKeys(clone);
keys.forEach((k) => {
methods.add(k);
});
}
while (obj = Reflect.getPrototypeOf(obj)) {
let keys = Reflect.ownKeys(obj);
keys.forEach((k) => {
methods.add(k);
});
}
return [...methods];
}
I would like a second opinion on this before I submit a pull request. Sorry for my inexperience :p.
@jxuan101 this does indeed seem to fix the problems with the help. I'm not sure why myself.
Please go ahead and submit the PR. Thank you so much for your help!
Welcome back! I cleaned up the code a bit but from what I understand, the getAllMethodNames function only listed the pseudo properties (get functions) in TerminalCommands.
Since the ES6 refactor PR #23 the 'help' command is no longer listing custom commands.