-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: allow leading period in multiline input #3835
Conversation
When writing multiline input, one can't chain function calls as if the lines begin with a period, since those are treated as REPL commands. Before: > ([0, 1, 2] ... .map(x => x + 1)) Invalid REPL keyword After: > ([0, 1, 2] ... .map(x => x + 1)) [ 1, 2, 3 ]
Actually, this is intentional. Let's say user types in something invalid, they can always type |
Oh yes, this preserves the current behaviour, just additionally allowing for chaining. So the following still works: > ([0, 1, 2]
... .break
> |
Oh, that's right. REPL command check happens before this. LGTM then. |
LGTM |
marked semver-minor since this represents a new capability in the REPL as opposed to a fix. |
@jasnell We can argue that its a bug fix, as |
It's a... ahem.. minor... point ;-) It'll land in v5.x soon either way. It's just not likely to be something that would land in v4.x. |
@nodejs/collaborators ... some additional review on this one would be appreciated. thank you! |
CI: https://ci.nodejs.org/job/node-test-pull-request/846/ Our repl tests are pretty good, Rubber-Stamp LGTM if it works. |
failing tests look unrelated. gtg. |
@Zirak your git info is |
@Fishrock123 On this part of the internet I go as Zirak. |
Ok, sounds good. Merging. :) |
When writing multiline input, one can't chain function calls as if the lines begin with a period, since those are treated as REPL commands. Before: > ([0, 1, 2] ... .map(x => x + 1)) Invalid REPL keyword After: > ([0, 1, 2] ... .map(x => x + 1)) [ 1, 2, 3 ] PR-URL: #3835 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Thanks, landed in 451254e! |
When writing multiline input, one can't chain function calls as if the lines begin with a period, since those are treated as REPL commands. Before: > ([0, 1, 2] ... .map(x => x + 1)) Invalid REPL keyword After: > ([0, 1, 2] ... .map(x => x + 1)) [ 1, 2, 3 ] PR-URL: #3835 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
When writing multiline input, one can't chain function calls as if the lines begin with a period, since those are treated as REPL commands. Before: > ([0, 1, 2] ... .map(x => x + 1)) Invalid REPL keyword After: > ([0, 1, 2] ... .map(x => x + 1)) [ 1, 2, 3 ] PR-URL: nodejs#3835 Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
When writing multiline input, one can't chain function calls as if the
lines begin with a period, since those are treated as REPL commands.
Before:
After: