pub struct Task {Show 18 fields
label: String,
type: Option<Type>,
command: String,
windows: Option<String>,
group: Option<String>,
presentation: Option<Presentation>,
options: Option<String>,
args: Option<Vec<Args>>,
depends_on: Option<Vec<String>>,
depends_order: Option<DependsOrder>,
detail: Option<String>,
icon: Option<String>,
is_background: Option<bool>,
linux: Option<String>,
osx: Option<String>,
problem_matcher: Option<Vec<ProblemMatcher>>,
prompt_on_close: Option<bool>,
run_options: Option<String>,
}
Expand description
Struct to represent a VSCode task as JSON.
Fields§
§label: String
The task’s label used in the user interface.
type: Option<Type>
The task’s type.
command: String
The actual command to execute.
windows: Option<String>
Any Windows specific properties. Will be used instead of the default properties when the command is executed on the Windows operating system.
group: Option<String>
Defines to which group the task belongs. In the example, it belongs to the test group. Tasks that belong to the test group can be executed by running Run Test Task from the Command Palette.
presentation: Option<Presentation>
Defines how the task output is handled in the user interface.
options: Option<String>
Override the defaults for cwd (current working directory), env (environment variables), or shell (default shell). Options can be set per task but also globally or per platform. Environment variables configured here can only be referenced from within your task script or process and will not be resolved if they are part of your args, command, or other task attributes.
args: Option<Vec<Args>>
Arguments passed to the command when this task is invoked.
depends_on: Option<Vec<String>>
Either a string representing another task or an array of other tasks that this task depends on.
depends_order: Option<DependsOrder>
Run all dependsOn tasks in parallel.
detail: Option<String>
An optional description of a task that shows in the Run Task quick pick as a detail.
icon: Option<String>
An optional icon path.
is_background: Option<bool>
Whether the executed task is kept alive and is running in the background.
linux: Option<String>
Any linux specific properties. Will be used instead of the default properties when the command is executed on the Linux operating system.
osx: Option<String>
Any macOS specific properties. Will be used instead of the default properties when the command is executed on the macOS operating system.
problem_matcher: Option<Vec<ProblemMatcher>>
The problem matcher(s) to use. Can either be a string or a problem matcher definition or an array of strings and problem matchers.
prompt_on_close: Option<bool>
Whether the user is prompted when VS Code closes with a running task.
run_options: Option<String>
The task’s run related options. Valid values are:
- reevaluateOnRerun: Controls how variables are evaluated when a
task is executed through the Rerun Last Task command. The default
is
true
, meaning that variables will be reevaluated when a task is rerun. When set tofalse
the resolved variable values from the previous run of the task will be used. - runOn: Specifies when a task is run.
default
- The task will only be run when executed through the Run Task command.folderOpen
- The task will be run when the containing folder is opened. The first time you open a folder that contains a task withfolderOpen
, you will be asked if you want to allow tasks to run automatically in that folder. You can change your decision later using the Manage Automatic Tasks in Folder command and selecting between Allow Automatic Tasks in Folder and Disallow Automatic Tasks in Folder.
Implementations§
source§impl Task
impl Task
sourcepub fn builder(
) -> TaskBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
pub fn builder( ) -> TaskBuilder<((), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), (), ())>
Create a builder for building Task
.
On the builder, call .label(...)
, .r#type(...)
(optional), .command(...)
(optional), .windows(...)
(optional), .group(...)
(optional), .presentation(...)
(optional), .options(...)
(optional), .args(...)
(optional), .depends_on(...)
(optional), .depends_order(...)
(optional), .detail(...)
(optional), .icon(...)
(optional), .is_background(...)
(optional), .linux(...)
(optional), .osx(...)
(optional), .problem_matcher(...)
(optional), .prompt_on_close(...)
(optional), .run_options(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of Task
.