Get .zed/debug.json to resolve debug tasks properly
Co-authored-by: Piotr <piotr@zed.dev>
This commit is contained in:
@@ -201,10 +201,6 @@ impl DebugAdapter for CustomDebugAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_debug_adapter_start_command(&self) -> String {
|
||||
"fail".to_string()
|
||||
}
|
||||
|
||||
fn is_installed(&self) -> Option<DebugAdapterBinary> {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@ use std::{
|
||||
};
|
||||
use task::{
|
||||
static_source::{StaticSource, TrackedFile},
|
||||
DebugAdapterConfig, HideStrategy, RevealStrategy, Shell, TaskContext, TaskTemplate,
|
||||
TaskVariables, VariableName,
|
||||
DebugAdapterConfig, DebugTaskFile, HideStrategy, RevealStrategy, Shell, TaskContext,
|
||||
TaskTemplate, TaskVariables, VariableName, VsCodeTaskFile,
|
||||
};
|
||||
use terminals::Terminals;
|
||||
use text::{Anchor, BufferId};
|
||||
@@ -4170,7 +4170,13 @@ impl Project {
|
||||
abs_path,
|
||||
id_base: "local_vscode_tasks_for_worktree".into(),
|
||||
},
|
||||
|tx, cx| StaticSource::new(TrackedFile::new(tasks_file_rx, tx, cx)),
|
||||
|tx, cx| {
|
||||
StaticSource::new(TrackedFile::new_convertible::<VsCodeTaskFile>(
|
||||
tasks_file_rx,
|
||||
tx,
|
||||
cx,
|
||||
))
|
||||
},
|
||||
cx,
|
||||
);
|
||||
}
|
||||
@@ -4191,7 +4197,11 @@ impl Project {
|
||||
id_base: "local_debug_file_for_worktree".into(),
|
||||
},
|
||||
|tx, cx| {
|
||||
StaticSource::new(TrackedFile::new(debug_task_file_rx, tx, cx))
|
||||
StaticSource::new(TrackedFile::new_convertible::<DebugTaskFile>(
|
||||
debug_task_file_rx,
|
||||
tx,
|
||||
cx,
|
||||
))
|
||||
},
|
||||
cx,
|
||||
);
|
||||
|
||||
@@ -138,6 +138,7 @@ impl DebugTaskDefinition {
|
||||
|
||||
/// A group of Debug Tasks defined in a JSON file.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
|
||||
#[serde(transparent)]
|
||||
pub struct DebugTaskFile(pub Vec<DebugTaskDefinition>);
|
||||
|
||||
impl DebugTaskFile {
|
||||
|
||||
@@ -78,6 +78,7 @@ impl<T: PartialEq + 'static + Sync> TrackedFile<T> {
|
||||
cx.background_executor()
|
||||
.spawn({
|
||||
let parsed_contents = parsed_contents.clone();
|
||||
|
||||
async move {
|
||||
while let Some(new_contents) = tracker.next().await {
|
||||
if Arc::strong_count(&parsed_contents) == 1 {
|
||||
@@ -109,9 +110,7 @@ impl<T: PartialEq + 'static + Sync> TrackedFile<T> {
|
||||
}
|
||||
})
|
||||
.detach_and_log_err(cx);
|
||||
Self {
|
||||
parsed_contents: Default::default(),
|
||||
}
|
||||
Self { parsed_contents }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,9 @@ impl TaskTemplate {
|
||||
/// Every [`ResolvedTask`] gets a [`TaskId`], based on the `id_base` (to avoid collision with various task sources),
|
||||
/// and hashes of its template and [`TaskContext`], see [`ResolvedTask`] fields' documentation for more details.
|
||||
pub fn resolve_task(&self, id_base: &str, cx: &TaskContext) -> Option<ResolvedTask> {
|
||||
if self.label.trim().is_empty() || self.command.trim().is_empty() {
|
||||
if self.label.trim().is_empty()
|
||||
|| (self.command.trim().is_empty() && matches!(self.task_type, TaskType::Script))
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user