Rust run configurations
To run a program, you can use run configurations. It allows you to customize the startup: add command line arguments, use custom commands, and so on.
To create a run configuration, you need to create run.json. For more information about creating run configurations, refer to Create a run configuration.
The following code snippet shows examples of different run configurations. See the descriptions of the fields in the Cargo section.
{
"configurations": [
{
"type": "cargo",
"name": "app_name_run",
"cargoArgs": ["run"],
"executableArgs": ["1","2","3"],
},
{
"type": "cargo",
"name": "app_name_build",
"cargoArgs": ["build"],
},
{
"type": "cargo",
"name": "app_name_check",
"cargoArgs": ["check"],
},
{
"type": "cargo",
"name": "app_name_test",
"cargoArgs": ["test"],
"executableArgs": ["1","2","3"],
},
]
}
You have the option to copy automatically generated run configurations to the clipboard and subsequently make modifications to them within the run.json file. These run configurations are automatically generated when you execute your code by using the run icon in the gutter.
Click the Run button that is located at the upper-right corner of the code editor. Alternatively, press Ctrl0R.
In the list of run configurations, click the ellipsis icon and select Copy configuration.
Once you have copied the run configuration, you can paste it into the run.json file and proceed to make any necessary parameter modifications.
You can edit existing run configurations in run.json. The run.json file is located in the .fleet directory.
Click the Run button that is located at the upper-right corner of the code editor. Alternatively, press Ctrl0R.
Click Edit Configurations to open run.json.
To edit a specific run configuration, click the ellipsis icon and select Edit configuration.
Once you have copied the run configuration, you can paste it into the run.json file and proceed to make any necessary parameter modifications.
If you are going to pass parameters to your program, add VM options (for example, to allow remote debugging), or otherwise customize the startup of your program, use a run/debug configuration.
Click the Run icon (Ctrl0R) and select Create Run Configurations in run.json.
In the run.json file that opens, define running or debugging parameters. If the file is empty, press AltEnter or click the file template link.
Alternatively, paste and edit the following code:
{ "configurations": [ { "type": "cargo", "name": "find_average_debug", "cargoArgs": ["run"], "executableArgs": ["1","2","3"], } ] }
Modify the configuration properties according to your environment.
Press Ctrl0R or select Run | Run & Debug from the main menu. Select the configuration that you are going to run or debug.
Runs cargo via `cargo $cargoArgs $cargoExtraArgs -- $executableArgs`
| Custom environment variables for the process in the form of a JSON object. To define an environment variable, add a property, where the key is the variable name and the value is the value of the variable, for example:
|
| Names of other configurations which will be executed before this configuration, for example: |
| Working directory for this run configuration. |
| When set to |
| Arguments to be passed to cargo Default value: |
| Extra arguments to be passed to cargo Default value: |
| Arguments to the program executed by cargo. These arguments go after '--' in the cargo command. Default value: |
Example:
{
"configurations": [
{
"type": "cargo",
"name": "app_name_run",
"cargoArgs": ["run"],
"executableArgs": ["1","2","3"]
},
{
"type": "cargo",
"name": "app_name_build",
"cargoArgs": ["build"]
},
{
"type": "cargo",
"name": "app_name_check",
"cargoArgs": ["check"]
},
{
"type": "cargo",
"name": "app_name_test",
"cargoArgs": ["test"],
"executableArgs": ["1","2","3"]
}
]
}
Thanks for your feedback!