Replicate Chris Rackauckas's Juno environment in VS Code from SciML demo in JuliaCon 2020

I’m interested in getting the kind of experience demonstrated starting here, where lines are presumably run in what seems to be a notebook-like manner, and the outputs of the lines are previewed to the right of the blue vertical line showing up inline with the code.

I see it’s in Juno, but is there currently a way to do this in VS Code? The extensions I’m finding don’t seem to match this.

VSCode’s Julia extension supports inline evaluation since version 16.0: Julia VS Code extension version v0.16 released
You can find some setting related to it in the settings of the julia extension. Is this what you are looking for?

3 Likes

You should be able to get the same look with VS Code. After you install the Julia extension, you’ll find the settings under Preferences → Extensions. You can do all of these things:

The extension currently provides:

Not sure why it doesn’t seem to be behaving for me then.

First, addressing inline evaluation. In the Julia extension (julialang.language-julia) v1.2.5 settings, I have the following set:
image

Then using CTRL+Enter to run a line, I get results only in the REPL:
image

Any suggestions on what I’m missing?

Unless there’s another setting that somehow cancels the inlining, it should work when you execute a cell. I’m not sure what the default keybindings are anymore, so I’m not sure what CTRL+ENTER does anymore. I use the following:

{
    "key": "f12",
    "command": "language-julia.executeCodeBlockOrSelectionAndMove"
},

you can replace f12 by whatever key you prefer: Does this work?

Is it possible now to out the REPL on the side in vscode, as he did there?

You need to restart vscode afterwards.

I went into settings and did a search for “panel”: it came up pretty self-explanatory. Just change the default location to “right”.

1 Like

In Julia’s VS Code keyboard shortcuts reference page, it is not clear what is the equivalent of your F12 keybinding.

In any case, there is nothing being previewed inline in VS Code to the right of the executed cell (OP’s question). It seems that one is just able to hover the cursor over variables and functions to get further information/help content?

I think the default is ALT+ENTER for that command, or that is what I have and I can’t remember changing it. That shows the results inline for me. CTRL+ENTER does only the current line, and it does not show the result for me.

2 Likes

Can you try albheim’s suggestion? If you go to “Keyboard Shortcuts” and search for “julia execute” you’ll see several options. The one that is bound to F12 on my system, but which has a different default binding, should work to inline the results.

1 Like

Checked the VS Code keyboard shortcuts and your F12 command is mapped as ALT + Enter. Executing the latter just outputs results to VS Code terminal (REPL).

Could you take a snapshot of your VS Code showing what is actually displayed?

1 Like

Did you change the Result Type to “inline” or “both”?

1 Like

@pfitzseb thank you, it was set to REPL only, my bad.
@ptoche thanks for the tips.

1 Like

Looks like it’s a known bug.

Whenever I use Alt+Enter (your F12), I get this error.

Running the contributed command: 'language-julia.executeCodeBlockOrSelectionAndMove' failed.

I’ve tried deleting the VSCodeServer/ as well as the entire v1.6/ directories as suggested, but the error persists.

@rafael.guerra, so changing the Result Type setting worked for you? I’ve tried every option, and results always come only to REPL, and Alt+Enter always gives an error. Shift+Enter also fails.

I’ve also tried a couple older versions of the extension with the same results.

@thompsonmj, yes it worked out well with the VS Code Julia extension setting result type: both.
It produces the inline info after ALT + Enter:

1 Like

In case it helps anyone, my issue here was that I was using a PC on a Windows domain with a network drive that was causing issues by splitting the extension installation in a way that I still don’t understand.

I got around this by creating a new local account where everything is only on the C: drive and my extension works perfectly.