Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Make autocompletion in REPL work #28

Merged
merged 1 commit into from
Mar 9, 2017
Merged

Conversation

aqrln
Copy link
Contributor

@aqrln aqrln commented Mar 7, 2017

There was a bug in internal/inspect_repl.js that caused REPL to crash
when trying to invoke autocomplete. Steps to reproduce:

  • Start the debugger.
  • Run repl command.
  • Type any letter.
  • Press <Tab>.
  • Node crashes with TypeError: elem.indexOf is not a function.

The reason is that Node's REPL expects a completion group to be an
array of strings while node-inspect passed an instance of ScopeSnapshot.

This commit fixes it by adding completion groups for REPL as properties
of ScopeSnapshot instances and returning them when evaluating ".scope".

There was a bug in `internal/inspect_repl.js` that caused REPL to crash
when trying to invoke autocomplete. Steps to reproduce:

* Start the debugger.
* Run `repl` command.
* Type any letter.
* Press <Tab>.
* Debugger crashes with `TypeError: elem.indexOf is not a function`.

The reason is that Node's REPL expects a completion group to be an
array of strings while node-inspect passed an instance of ScopeSnapshot.

This commit fixes it by adding completion groups for REPL as properties
of ScopeSnapshot instances and returning them when evaluating ".scope".
@jkrems
Copy link
Collaborator

jkrems commented Mar 9, 2017

Thanks & sorry for the delay. Tested locally & verified. Not sure myself if our current test setup allows sending <Tab>, might be a good thing to follow up on (so that we can get a regression test for this).

CI run: https://ci.nodejs.org/view/x%20-%20Diagnostics/job/node-inspect-continuous-integration/13/

@jkrems jkrems changed the title fix: Make autocompletion in REPL work Make autocompletion in REPL work Mar 9, 2017
@jkrems
Copy link
Collaborator

jkrems commented Mar 9, 2017

CI passes apart from the windows failures we're seeing on master as well.

@jkrems jkrems merged commit 2cfe74b into nodejs:master Mar 9, 2017
@aqrln aqrln deleted the fix-repl-crash branch March 9, 2017 20:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants