-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
repl: include folder extensions in autocomplete #14727
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: include folder extensions in autocomplete #14727
Conversation
Trott
left a comment
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.
LGTM if CI passes
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.
LGTM. It might be possible to reuse existing fixtures instead of creating new ones, but not a big deal.
EDIT: Disregard my comment about reusing an existing fixture :-)
lib/repl.js
Outdated
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.
Looking at this again, I'm wondering if this should be moved back into a try-catch to avoid creating an error if the path doesn't exist.
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.
It would be a race condition that is hart to trigger but as there was a guard for this before I would say it should be kept as it was.
lib/repl.js
Outdated
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.
It would be a race condition that is hart to trigger but as there was a guard for this before I would say it should be kept as it was.
lib/repl.js
Outdated
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.
The try should be moved into the if statement as it is not necessary for non directories.
BridgeAR
left a comment
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.
LGTM with a nit.
lib/repl.js
Outdated
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.
Nit: you could get rid of one of the isDirectory checks (the churn is there anyway).
if (isDirectory) {
// ...
} else if (exts.includes(ext)) {
// ...
}
aqrln
left a comment
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.
Still LGTM 👍
31e2174 to
b646a3d
Compare
When autocompleting `require` calls, the repl strips .js file extensions from results. However, stripping an extension from a directory results in an error. Update the autocompletion logic to avoid stripping extensions from directories. PR-URL: nodejs#14727 Fixes: nodejs#14726 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
|
Landed in b646a3d |
When autocompleting `require` calls, the repl strips .js file extensions from results. However, stripping an extension from a directory results in an error. Update the autocompletion logic to avoid stripping extensions from directories. PR-URL: #14727 Fixes: #14726 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
repl
When autocompleting
requirecalls, the repl strips .js file extensions from results. However, stripping an extension from a directory results in an error whenrequireis called. Update the autocompletion logic to avoid stripping extensions from directories.Fixes: #14726