Add initial package.json
scripts task autodetection (#32497)
Now, every JS/TS-related file will get their package.json script contents added as tasks: <img width="1020" alt="image" src="https://github.com/user-attachments/assets/5bf80f80-fd72-4ba8-8ccf-418872895a25" /> To achieve that, `fn associated_tasks` from the `ContextProvider` was made asynchronous and the related code adjusted. Release Notes: - Added initial `package.json` scripts task autodetection --------- Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
This commit is contained in:
parent
0c0933d1c0
commit
9c513223c4
15 changed files with 782 additions and 661 deletions
|
@ -510,9 +510,10 @@ impl ContextProvider for GoContextProvider {
|
|||
|
||||
fn associated_tasks(
|
||||
&self,
|
||||
_: Option<Arc<dyn language::File>>,
|
||||
_: Arc<dyn Fs>,
|
||||
_: Option<Arc<dyn File>>,
|
||||
_: &App,
|
||||
) -> Option<TaskTemplates> {
|
||||
) -> Task<Option<TaskTemplates>> {
|
||||
let package_cwd = if GO_PACKAGE_TASK_VARIABLE.template_value() == "." {
|
||||
None
|
||||
} else {
|
||||
|
@ -520,7 +521,7 @@ impl ContextProvider for GoContextProvider {
|
|||
};
|
||||
let module_cwd = Some(GO_MODULE_ROOT_TASK_VARIABLE.template_value());
|
||||
|
||||
Some(TaskTemplates(vec![
|
||||
Task::ready(Some(TaskTemplates(vec![
|
||||
TaskTemplate {
|
||||
label: format!(
|
||||
"go test {} -run {}",
|
||||
|
@ -631,7 +632,7 @@ impl ContextProvider for GoContextProvider {
|
|||
cwd: module_cwd.clone(),
|
||||
..TaskTemplate::default()
|
||||
},
|
||||
]))
|
||||
])))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue