Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
osiewicz committed Feb 17, 2025
1 parent b1ca8c3 commit a0c91d6
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions crates/project/src/debugger/dap_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,27 @@ pub struct DapStore {

impl EventEmitter<DapStoreEvent> for DapStore {}

fn dap_client_capabilities(adapter_id: String) -> InitializeRequestArguments {
InitializeRequestArguments {
client_id: Some("zed".to_owned()),
client_name: Some("Zed".to_owned()),
adapter_id,
locale: Some("en-US".to_owned()),
path_format: Some(InitializeRequestArgumentsPathFormat::Path),
supports_variable_type: Some(true),
supports_variable_paging: Some(false),
supports_run_in_terminal_request: Some(true),
supports_memory_references: Some(true),
supports_progress_reporting: Some(false),
supports_invalidated_event: Some(false),
lines_start_at1: Some(true),
columns_start_at1: Some(true),
supports_memory_event: Some(false),
supports_args_can_be_interpreted_by_shell: Some(false),
supports_start_debugging_request: Some(true),
}
}
impl DapStore {
const INDEX_STARTS_AT_ONE: bool = true;

pub fn init(client: &AnyProtoClient) {
client.add_entity_message_handler(Self::handle_remove_active_debug_line);
client.add_entity_message_handler(Self::handle_shutdown_debug_client);
Expand Down Expand Up @@ -585,24 +603,7 @@ impl DapStore {

cx.spawn(|this, mut cx| async move {
let capabilities = client
.request::<Initialize>(InitializeRequestArguments {
client_id: Some("zed".to_owned()),
client_name: Some("Zed".to_owned()),
adapter_id: client.adapter_id(),
locale: Some("en-US".to_owned()),
path_format: Some(InitializeRequestArgumentsPathFormat::Path),
supports_variable_type: Some(true),
supports_variable_paging: Some(false),
supports_run_in_terminal_request: Some(true),
supports_memory_references: Some(true),
supports_progress_reporting: Some(false),
supports_invalidated_event: Some(false),
lines_start_at1: Some(Self::INDEX_STARTS_AT_ONE),
columns_start_at1: Some(Self::INDEX_STARTS_AT_ONE),
supports_memory_event: Some(false),
supports_args_can_be_interpreted_by_shell: Some(false),
supports_start_debugging_request: Some(true),
})
.request::<Initialize>(dap_client_capabilities(client.adapter_id()))
.await?;

this.update(&mut cx, |store, cx| {
Expand Down Expand Up @@ -1185,9 +1186,8 @@ impl DapStore {
return Task::ready(Err(anyhow!("Could not find client: {:?}", client_id)));
};

if Self::INDEX_STARTS_AT_ONE {
breakpoints.iter_mut().for_each(|bp| bp.line += 1u64)
}
// Adjust breakpoints as our client declares that indices start at one.
breakpoints.iter_mut().for_each(|bp| bp.line += 1u64);

cx.background_executor().spawn(async move {
client
Expand Down

0 comments on commit a0c91d6

Please sign in to comment.