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
{{ message }}
Repository navigation
pasting tab-indented code into the repl wrongly triggers autocomplete #5954
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.
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
Activity
Fishrock123 commentedon Mar 30, 2016
Looks like it's activating tab-complete.
I think it shouldn't be too difficult to fix.
[-]'Cannot read property 'outputStream' of undefined' when pasting js into nodejs interactive promt[/-][+]pasting tab-indented code into the repl wrongly triggers autocomplete[/+]ghaiklor commentedon Mar 30, 2016
@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 commentedon Mar 30, 2016
@ghaiklor GitHub turns the tabs into spaces for code blocks, copy this: https://gist.github.com/Fishrock123/0c6aeb910948a3f2d844736918e6b187
ghaiklor commentedon Mar 30, 2016
@Fishrock123 got it, thanks.
benjamingr commentedon Mar 31, 2016
Removed the good first contribution label on account of @ghaiklor picking up the glove and taking a stab at it :)
eljefedelrodeodeljefe commentedon Apr 29, 2016
Is someone moving forward with a patch?
ghaiklor commentedon Apr 29, 2016
@eljefedelrodeodeljefe yes, PR is on review - #5958
repl: copying tabs shouldn't trigger completion
repl: copying tabs shouldn't trigger completion
repl: copying tabs shouldn't trigger completion
repl: copying tabs shouldn't trigger completion
repl: copying tabs shouldn't trigger completion
repl: copying tabs shouldn't trigger completion
repl: copying tabs shouldn't trigger completion