| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Sorry, something went wrong.
PR-URL: #43543 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #43543 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #43543 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs/node#43543 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
Fixes #43528. This PR fixes the REPL on editor mode crashing during tab completion.
The root cause of this issue is that commonPrefix could receive an empty array of completions because of #41632.
On editor mode, the completions are converted into the common prefix string in REPLServer.prototype.completeOnEditorModeL1603 (I'm not sure why this wrapper is needed). And then [kTabCompleter]() is called as a callback with the completion as its argument.
node/lib/repl.js
Lines 1596 to 1607 in 6f924ac
For example, the completions for a are ['async', 'await', 'Array', ...] (note that #41632 made REPL case-incentive) and their common prefix string is '' (the return value of commonPrefix(['async', 'await', 'Array', ...])).
This means the completions is [''] when [kTabCompleter]() is called, and commonPrefix([]) will be called at L670.
node/lib/internal/readline/interface.js
Lines 662 to 672 in 6f924ac