镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

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

Activity

  1. added
    replIssues and PRs related to the REPL subsystem.
    on Mar 30, 2016
  2. Fishrock123 commented on Mar 30, 2016

    @Fishrock123
    Contributor

    Looks like it's activating tab-complete.

    I think it shouldn't be too difficult to fix.

  3. added
    confirmed-bugIssues and PRs for confirmed bugs.
    good first issueIssues that are suitable for first-time contributors.
    on Mar 30, 2016
  4. changed the title [-]'Cannot read property 'outputStream' of undefined' when pasting js into nodejs interactive promt[/-] [+]pasting tab-indented code into the repl wrongly triggers autocomplete[/+] on Mar 30, 2016
  5. ghaiklor commented on Mar 30, 2016

    @ghaiklor
    Contributor

    @Fishrock123 I can take this issue, but I'm not totally understand, how to reproduce this issue. Is there some code to reproduce this issue ?

    UPD: As I understand, when you paste Tab symbols, Node is thinking that you have pressed this button instead of pasting it.

  6. Fishrock123 commented on Mar 30, 2016

    @Fishrock123
    Contributor
  7. ghaiklor commented on Mar 30, 2016

    @ghaiklor
    Contributor

    @Fishrock123 got it, thanks.

  8. benjamingr commented on Mar 31, 2016

    @benjamingr
    Member

    Removed the good first contribution label on account of @ghaiklor picking up the glove and taking a stab at it :)

  9. eljefedelrodeodeljefe commented on Apr 29, 2016

    @eljefedelrodeodeljefe
    Contributor

    Is someone moving forward with a patch?

  10. ghaiklor commented on Apr 29, 2016

    @ghaiklor
    Contributor

    @eljefedelrodeodeljefe yes, PR is on review - #5958

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for 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