You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok this is interesting. I'm not sure, why we do call onAutocomplete when user types in .? Also, the same code snippet works perfectly fine in normal repl along with proper tab completion. A quick question here can't we simply use Object.getOwnPropertyNames() to get the list of method names here rather than using Runtime.getProperties are there any advantages here?
I'm not too experienced with child processes in NodeJS (child_process module), but would moving autocompletion / eager evaluation to a killable fork make sense?
The result would then be shown asynchronously.
When the input is submitted or is changed to something syntactically different (if there's efficient ways to check this, something like removing a semicolon at the very end shouldn't re-trigger it), the fork could be killed off and the new thing would be evaluated.
Example from the Chrome devtools (although they don't kill it if it doesn't complete quickly enough but instead it clogs the main process):
https://github.com/devsnek/node-repl-prototype/blob/5e72bed5a127c0b3e1c7289d75c3eb157db43522/src/repl.js#L146-L149
getPropertiesdoesn't allow any sort of timeout, so it will take forever for an object likeArray(1000000).fill(0)