-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
repl: fix tab completion for object properties with special characters #21556
Conversation
bb91120
to
c56417e
Compare
Would it be possible to generate proper tab completions for the other keys? I.e. autocomplete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might find https://github.com/devsnek/node-repl-prototype/blob/5e72bed5a127c0b3e1c7289d75c3eb157db43522/src/repl.js#L154-L169 to be helpful to enhance the behavior for [
property references.
lib/repl.js
Outdated
// Filters the elements that pass the regexp: | ||
// 1. Starting with A-Z, a-z, $ or _ | ||
// 2. Following with A-Z, a-z, 0-9, $ or _ | ||
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(item); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With acorn in tree, we could actually do something like
for higher accuracy.
@addaleax Rewrite the user input from |
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
2a999a6
to
4443b61
Compare
CI before landing: https://ci.nodejs.org/job/node-test-pull-request/15704/ |
Landed in 4f15122 |
The old RegExp will pass property names like
"hello world!"
when filtering the results of tab complete. This change is to fix it.By the way, now the repl module doesn't support tab complete like
obj[<tab>
. Is there any plan for this?Fixes: #21201
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes