julia-repl icon indicating copy to clipboard operation
julia-repl copied to clipboard

Send block

Open jtrakk opened this issue 4 years ago • 2 comments

Emacs 27.2
Julia 1.6.1
julia-repl-20210408.639

I want to execute a multiline code block:

[1,2,3] |>
maximum

C-c C-c is julia-repl-send-region-or-line which only sends the line by default. vscode-julia sends the whole block. Would it be possible to have that in emacs too?

jtrakk avatar Oct 17 '21 18:10 jtrakk

I personally use the following function:

  (defun julia-send-paragraph ()
    (interactive)
    (save-mark-and-excursion
      (mark-paragraph)
      (julia-repl-send-region-or-line)))

It behaves differently than VS Code, because the block must be delimited by empty lines and AFAIK VS Code automatically recognizes multi-line expressions without extra delimiters. But for me, it's sufficient most of the time.

wentasah avatar Oct 17 '21 22:10 wentasah

That may be an improvement, thanks. As you note, sometimes paragraph is too small, e.g. if there are blank lines in the block, and sometimes too large, e.g. if there are multiple independent blocks without blank lines between them.

It looks like LanguageServer uses julia/getCurrentBlockRange.

jtrakk avatar Oct 17 '21 23:10 jtrakk