Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
pps83 opened this issue Mar 30, 2016 · 7 comments
Closed

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

pps83 opened this issue Mar 30, 2016 · 7 comments
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.

Comments

@pps83
Copy link

pps83 commented Mar 30, 2016

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
@mscdex mscdex added the repl Issues and PRs related to the REPL subsystem. label Mar 30, 2016
@Fishrock123
Copy link
Contributor

Looks like it's activating tab-complete.

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

@Fishrock123 Fishrock123 added confirmed-bug Issues with confirmed bugs. good first issue Issues that are suitable for first-time contributors. labels Mar 30, 2016
@Fishrock123 Fishrock123 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 Mar 30, 2016
@ghaiklor
Copy link
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.

@Fishrock123
Copy link
Contributor

@ghaiklor GitHub turns the tabs into spaces for code blocks, copy this: https://gist.github.com/Fishrock123/0c6aeb910948a3f2d844736918e6b187

@ghaiklor
Copy link
Contributor

@Fishrock123 got it, thanks.

@benjamingr benjamingr removed the good first issue Issues that are suitable for first-time contributors. label Mar 31, 2016
@benjamingr
Copy link
Member

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

@eljefedelrodeodeljefe
Copy link
Contributor

Is someone moving forward with a patch?

@ghaiklor
Copy link
Contributor

@eljefedelrodeodeljefe yes, PR is on review - #5958

evanlucas pushed a commit that referenced this issue May 17, 2016
PR-URL: #5958
Fixes: #5954
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this issue Jul 11, 2016
PR-URL: #5958
Fixes: #5954
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this issue Jul 11, 2016
PR-URL: #5958
Fixes: #5954
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
PR-URL: #5958
Fixes: #5954
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
PR-URL: #5958
Fixes: #5954
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
PR-URL: #5958
Fixes: #5954
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

6 participants