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

Bad tab completion for object properties with special characters #21201

Closed
jyn514 opened this issue Jun 7, 2018 · 3 comments
Closed

Bad tab completion for object properties with special characters #21201

jyn514 opened this issue Jun 7, 2018 · 3 comments
Labels
confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem.

Comments

@jyn514
Copy link

jyn514 commented Jun 7, 2018

  • Version: v8.11.0
  • Platform: Linux fedora-thinkpad 4.13.9-300.fc27.x86_64 #1 SMP Mon Oct 23 13:41:58 UTC
  • Subsystem: n/a
> d = {'hello, world!': 'some string'}
{ 'hello, world!': 'some string' }
> d.hello<tab>
> d.hello, world!<enter>
... 
... 
> <keyboard interrupt> 

When an object has special characters as one of it's properties, node will autocomplete that property, but continue waiting for input (as the completed property is invalid syntax). This is not desired behaviour.

This issue is also present in Firefox, but not in Chrome.

@addaleax addaleax added confirmed-bug Issues with confirmed bugs. repl Issues and PRs related to the REPL subsystem. labels Jun 7, 2018
@addaleax
Copy link
Member

addaleax commented Jun 7, 2018

@nodejs/repl

@devsnek
Copy link
Member

devsnek commented Jun 8, 2018

what i did in my repl prototype to fix this was amend our autocomplete regex to allow [ additionally to . and then filter properties based on whether they were doing computed access or dot access and then format the output accordingly:

https://github.com/devsnek/node-repl-prototype/blob/feae58a2de7b91b6e33f4c33194a69678f0bcc20/src/repl.js#L103-L109

i don't know how well this will mesh into our current repl code.

@ryzokuken
Copy link
Contributor

@devsnek did you look into it? Was there any progress?

starkwang added a commit to starkwang/node that referenced this issue Jul 2, 2018
The old RegExp will pass property names like `"hello world!"`
when filtering the results of tab complete. This change is to
fix it.

Fixes: nodejs#21201
targos pushed a commit that referenced this issue Jul 3, 2018
The old RegExp will pass property names like `"hello world!"`
when filtering the results of tab complete. This change is to
fix it.

Fixes: #21201

PR-URL: #21556
Fixes: #21201
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.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

Successfully merging a pull request may close this issue.

4 participants