Run full code on VSCode

You already seem to have figured out how to send code from a file within VS Code to the integrated REPL via Ctrl + Enter (for single lines or selected lines) or Shift + Enter (for code blocks divided by ##).

You can either do Ctrl + A Ctrl + Enter to send the whole content of a file to the Julia REPL. (Quick and simple solution without changing your workflow much.)

Or you could follow these two steps that also do what you want:

  1. Open the Julia REPL in VS Code via Alt+J Alt+O.
  2. Execute include("myfile.jl") inside the REPL.

Make sure your current working directory is correct. Exchange “myfile.jl” with whatever your file is called. You can also pass a full file path (e.g. "../../path/to/file/myfile.jl") to the include function. This is useful if you want to access files in another directory than your current working directory but without changing it via cd() first.

Done. :slight_smile: Does this do what you want?

4 Likes