Skip to content

pasting tab-indented code into the repl wrongly triggers autocomplete #5954

Closed
@pps83

Description

@pps83

If you run node and then paste some script that contains tabs for indentation then node will exit with an exception:

function test(){
    a();
    a();
}

make sure that this piece contains tabs for indentation and paste it into node interactive shell. On tab char it will print lots of bs suggestions and then at the end:

> function test(){
...
...TONNES OF POINTLESS HINTS...
... a();
... repl.js:282
    top.outputStream.write((e.stack || e) + '\n');
       ^

TypeError: Cannot read property 'outputStream' of undefined
    at Domain.<anonymous> (repl.js:282:8)
    at emitOne (events.js:77:13)
    at Domain.emit (events.js:169:7)
    at emitError (domain.js:66:24)
    at Domain.errorHandler [as _errorHandler] (domain.js:110:18)
    at process._fatalException (node.js:216:33)

Surprisingly, if you have only one line inside test function above, then it doesn't throw. Also, on each tab node will print huge pile of suggestions. It would be nice if it could detect that extra chars follow the tab immediately and avoid showing suggestions. I get identical behavior with nodev4 on win, and nodev5 on ubuntu.

  • Version: v4.3.1 on win, or v5.9.1 on ubuntu
  • Platform: win32, ubuntu-64

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions