tpapp/julia-repl

Send block

jtrakk opened this issue · 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?

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.

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.