Skip to content
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

When using in REPL, JuliaSyntax.jl does not seem to work well with multiline parsing? #42

Closed
singularitti opened this issue Aug 11, 2022 · 4 comments · Fixed by #102
Closed
Labels
bug Something isn't working

Comments

@singularitti
Copy link

singularitti commented Aug 11, 2022

When I want to type

map(1:10) do x
    2x
end

after I type map(1:10) do x and hit return, I got

julia> map(1:10) do
ERROR: ParseError:
Error: premature end of input
@ REPL[11]:2:1
map(1:10) do
Error: premature end of input
@ REPL[11]:2:1
map(1:10) do
Error: Expected `end` but got unexpected tokens
@ REPL[11]:2:1
map(1:10) do

Or if I want to type

 w = u +
     v +
     1

I got

julia> w = u +
ERROR: ParseError:
Error: premature end of input
@ REPL[14]:2:1
w = u +

But I can do them with copy-paste:

image

Can we make the REPL-mode tolerate multiline code a little bit more?

@c42f
Copy link
Member

c42f commented Aug 12, 2022

Yes this is a bug, thanks for opening an issue!

What we need to do is detect "incomplete" expressions and emit Expr(:incomplete) for these to make this work.

In the meantime, you can use the REPL's ALT+Return keybinding to enter a newline without going through the parser (this is what keeps me sane 😅 )

@singularitti
Copy link
Author

Hi @c42f, I just tried Alt+Return (on macOS is it probably Option+Return?) But it does not seem to work. Is it a different keybinding on Macs? I have tried Control+Return & Command+Return though.

@c42f
Copy link
Member

c42f commented Aug 12, 2022

I'm not sure I don't use macOS. It might be a setting on your terminal emulator https://apple.stackexchange.com/questions/1391/equivalent-to-alt-in-terminal ?

@singularitti
Copy link
Author

singularitti commented Aug 12, 2022

Oh, it works. Maybe because I was using iTerm? I don't know. Thanks for helping!

@c42f c42f added the bug Something isn't working label Aug 12, 2022
aviatesk added a commit that referenced this issue Aug 24, 2022
aviatesk added a commit that referenced this issue Aug 24, 2022
@c42f c42f closed this as completed in #102 Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants