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

Feature request - Allow selection to be sent as single line #194

Closed
mitermayer opened this issue Mar 27, 2019 · 8 comments
Closed

Feature request - Allow selection to be sent as single line #194

mitermayer opened this issue Mar 27, 2019 · 8 comments
Labels

Comments

@mitermayer
Copy link

Background

I really enjoy that when doing "" slime sends all the block lines one by one to the repl. But some repls require the block to be sent at once.

Poblem

Some repls do not support multine and require all commands to be inlined.

Proposal

Would be great if there was an option to send all the current selection inlined into a single line for repls that do not support multiline commands

@jpalardy
Copy link
Owner

Hi there,

By default, slime sends a block as a "chunk", not line by line. That behavior defaults on the ftplugin though.

What kind of code and REPL are you using?

@mitermayer
Copy link
Author

@jpalardy,

We use "hack" (https://github.com/facebook/hhvm) at FB. When I attempt to send it to the repl it is currently sending line by line which is incompatible with what hphpd expects.

@jpalardy
Copy link
Owner

If you could show me a minimal example, I would try to reproduce and debug it myself.

Specifically:

  • your setup (tmux, bash, other relevant)
  • how you run the REPL
  • what code block to send to reproduce

Thanks

@avonmoll
Copy link

avonmoll commented Aug 1, 2019

I'm not sure if this is actually the same issue that OP is describing, but I am seeing something like the following:

.slime_paste contains

x = 1

y = 2

and when this gets sent to the Julia REPL, for example, each line is evaluated individually:

julia> x = 1
1

julia>

julia> y = 2
2

However, inside Julia's REPL, you can enter multi-line commands by typing x = 1Alt+EnterAlt+Entery = 2Enter.

@jpalardy
Copy link
Owner

jpalardy commented Aug 1, 2019

Hi @avonmoll,

Trimming the blank line(s) between code lines is something that could be done by the ftplugin.

As for inserting Alt-Enter … that's trickier. Is Alt-Enter even a sequence that could be inserted in .slime_paste or something the REPL captures directly from its inputs 🤔

@avonmoll
Copy link

avonmoll commented Aug 1, 2019

That's an interesting question that I don't know the answer to. I think that where this issue might matter is in cases like the following

function multiplyBy2(x)
    return 2*x

end

Fortunately, in the case of Julia, the REPL knows to wait for an end when it sees the start of a code block. Thus typing function multiplyBy2(x)Enter advances to a new line automatically (much like Alt+Enter would. However, I wonder if the REPL mentioned by OP doesn't handle this situation as I described.

Side note: considering opening an issue requesting Julia support as I don't know if I am patient enough to figure out how to write the ftplugin part myself :)

@stale
Copy link

stale bot commented Nov 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 1, 2019
@stale stale bot closed this as completed Nov 8, 2019
@junyixu
Copy link
Contributor

junyixu commented Aug 21, 2022

What about
begin
your code
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants