# Setting run/build target?

**URL:** <https://discourse.julialang.org/t/setting-run-build-target/107049>\
**Category:** VS Code\
**Created:** [December 2, 2023, 5:40pm UTC](https://discourse.julialang.org/t/setting-run-build-target/107049 "2023-12-02T17:40:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grahamas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/grahamas/32/3401_2.png) [@grahamas](https://discourse.julialang.org/u/grahamas)\
**Post date:** [December 2, 2023, 5:40pm UTC](https://discourse.julialang.org/t/setting-run-build-target/107049/1 "2023-12-02T17:40:00Z")

</div>

Most of the time, my workflow is something like

1. Write module
2. Write script calling functions in module
3. Run script and get an error in a function in the module
4. Fix error
5. Repeat steps 3-4 forever

The problem is that after fixing the function error, every single time I have to click back to my script and run it. Because of the way VS Code opens tabs, it never stays put where I expect it, and even if it did, inevitably there’s a new error in the same function I was just in, so I end up having to click back and forth.

What I’d like to be able to do is to designate a script as my “build target” and then have a global keyboard shortcut that runs that file (i.e. “Execute file in REPL” but a pre-specified file, not an active file). That way when I fix the function, I could stay in that file, smash some shortcut, and have my script run, and then already be in the right file to fix the next error.

I don’t mind too much going into the settings and manually editing the path target file every once in a while, but it’d be nicer if there were also a shortcut that did “Designate this file as the build target.”

How would I do this?

(I’m also open to completely new workflow suggestions)

---

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [December 5, 2023, 10:25am UTC](https://discourse.julialang.org/t/setting-run-build-target/107049/2 "2023-12-05T10:25:30Z")

</div>

My workflow is to have my active Julia session up and type `include("path/to/script.jl")`. Then rerunning is just CTRL+J to open the terminal, up arrow then enter to run my last command. I use Revise to make sure the module stays up to date.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [December 6, 2023, 5:01am UTC](https://discourse.julialang.org/t/setting-run-build-target/107049/3 "2023-12-06T05:01:10Z")

</div>

A [Revise](https://docs.julialang.org/en/v1/manual/workflow-tips/#Revise-based-workflows) based workflow really helps.

1. Load the module as package via `using`.
2. Turn the script into a function.
3. Include the script via `Revise.includet` which is exported.

Now each iteration just requires you to rerun the function in the REPL. Chnages to module and function will be updated automatically before each REPL command.
