-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code Insiderson-testplantasksTask system issuesTask system issues
Milestone
Description
Motivation
our codebase has a mix of different languages. Some .php files some .js files for example.
I need to keep switching the default task depending on which file I’m working on, it can become quite frustrating.
Is it possible to have a default task for that file extension? So when I’m working in JS I can just run the default task, and when I’m in .php I can run the default task for that?
launch.json example from a typical project
[
{
"label": "Test JS File",
"type": "shell",
"command": "yarn jest ${file}",
"extension": "js",
"group": {
"kind": "test",
},
},
{
"label": "Test PHP File",
"type": "shell",
"command": "phpunit ${file}",
"extension": "php",
"group": {
"kind": "test",
},
}
]Backwards Compatibility
- Option 1: Default tasks can work as they are now, if a task based on file extension is added this can override the default task. So extension based tasks have higher priority.
- Option 2: If no default task is set then fallback to checking if an
extensionhas been set. This waydefaultTaskis still guaranteed to work as it does today - Option 3: Another option is to use globs instead, and run the task by default if it matches the particular glob pattern (see below). This can override
defaultTask
Example table (if globs are used)
| Current Open File Extension | File | Task |
|---|---|---|
.js |
javascript | Run JS file |
.php |
PHP | Run PHP File, or run PHP tests |
.test.js |
Javascript test file | Run Tests |
.html |
HTML File | Open browser with this file |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalityinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code Insiderson-testplantasksTask system issuesTask system issues