repl: include folder extensions in autocomplete#14727
repl: include folder extensions in autocomplete#14727not-an-aardvark wants to merge 0 commit intonodejs:masterfrom
Conversation
lib/repl.js
Outdated
There was a problem hiding this comment.
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.
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.
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.
The try should be moved into the if statement as it is not necessary for non directories.
lib/repl.js
Outdated
There was a problem hiding this comment.
Nit: you could get rid of one of the isDirectory checks (the churn is there anyway).
if (isDirectory) {
// ...
} else if (exts.includes(ext)) {
// ...
}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