1mod codelldb;
2mod gdb;
3mod go;
4mod javascript;
5mod php;
6mod python;
7mod ruby;
8
9use std::sync::Arc;
10
11use anyhow::Result;
12use async_trait::async_trait;
13use codelldb::CodeLldbDebugAdapter;
14use dap::{
15 DapRegistry, DebugRequest,
16 adapters::{
17 self, AdapterVersion, DapDelegate, DebugAdapter, DebugAdapterBinary, DebugAdapterName,
18 GithubRepo,
19 },
20 configure_tcp_connection,
21 inline_value::{PythonInlineValueProvider, RustInlineValueProvider},
22};
23use gdb::GdbDebugAdapter;
24use go::GoDebugAdapter;
25use gpui::{App, BorrowAppContext};
26use javascript::JsDebugAdapter;
27use php::PhpDebugAdapter;
28use python::PythonDebugAdapter;
29use ruby::RubyDebugAdapter;
30use serde_json::{Value, json};
31
32pub fn init(cx: &mut App) {
33 cx.update_default_global(|registry: &mut DapRegistry, _cx| {
34 registry.add_adapter(Arc::from(CodeLldbDebugAdapter::default()));
35 registry.add_adapter(Arc::from(PythonDebugAdapter::default()));
36 registry.add_adapter(Arc::from(PhpDebugAdapter::default()));
37 registry.add_adapter(Arc::from(JsDebugAdapter::default()));
38 registry.add_adapter(Arc::from(RubyDebugAdapter));
39 registry.add_adapter(Arc::from(GoDebugAdapter));
40 registry.add_adapter(Arc::from(GdbDebugAdapter));
41
42 registry.add_inline_value_provider("Rust".to_string(), Arc::from(RustInlineValueProvider));
43 registry
44 .add_inline_value_provider("Python".to_string(), Arc::from(PythonInlineValueProvider));
45 })
46}
47
48trait ToDap {
49 fn to_dap(&self) -> dap::StartDebuggingRequestArgumentsRequest;
50}
51
52impl ToDap for DebugRequest {
53 fn to_dap(&self) -> dap::StartDebuggingRequestArgumentsRequest {
54 match self {
55 Self::Launch(_) => dap::StartDebuggingRequestArgumentsRequest::Launch,
56 Self::Attach(_) => dap::StartDebuggingRequestArgumentsRequest::Attach,
57 }
58 }
59}