debugger: Use DAP schema to configure daps (#30833)
This PR allows DAPs to define their own schema so users can see completion items when editing their debug.json files. Users facing this aren’t the biggest chance, but behind the scenes, this affected a lot of code because we manually translated common fields from Zed's config format to be adapter-specific. Now we store the raw JSON from a user's configuration file and just send that. I'm ignoring the Protobuf CICD error because the DebugTaskDefinition message is not yet user facing and we need to deprecate some fields in it. Release Notes: - debugger beta: Show completion items when editing debug.json - debugger beta: Breaking change, debug.json schema now relays on what DAP you have selected instead of always having the same based values. --------- Co-authored-by: Remco Smits <djsmits12@gmail.com> Co-authored-by: Cole Miller <m@cole-miller.net> Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
parent
0d7f4842f3
commit
1c9b818342
43 changed files with 2357 additions and 740 deletions
|
@ -20,7 +20,7 @@ pub use wit::{
|
|||
make_file_executable,
|
||||
zed::extension::context_server::ContextServerConfiguration,
|
||||
zed::extension::dap::{
|
||||
DebugAdapterBinary, DebugRequest, DebugTaskDefinition, StartDebuggingRequestArguments,
|
||||
DebugAdapterBinary, DebugTaskDefinition, StartDebuggingRequestArguments,
|
||||
StartDebuggingRequestArgumentsRequest, TcpArguments, TcpArgumentsTemplate,
|
||||
resolve_tcp_template,
|
||||
},
|
||||
|
@ -203,6 +203,10 @@ pub trait Extension: Send + Sync {
|
|||
) -> Result<DebugAdapterBinary, String> {
|
||||
Err("`get_dap_binary` not implemented".to_string())
|
||||
}
|
||||
|
||||
fn dap_schema(&mut self) -> Result<serde_json::Value, String> {
|
||||
Err("`dap_schema` not implemented".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// Registers the provided type as a Zed extension.
|
||||
|
@ -396,6 +400,10 @@ impl wit::Guest for Component {
|
|||
) -> Result<wit::DebugAdapterBinary, String> {
|
||||
extension().get_dap_binary(adapter_name, config, user_installed_path, worktree)
|
||||
}
|
||||
|
||||
fn dap_schema() -> Result<String, String> {
|
||||
extension().dap_schema().map(|schema| schema.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// The ID of a language server.
|
||||
|
|
|
@ -35,9 +35,7 @@ interface dap {
|
|||
record debug-task-definition {
|
||||
label: string,
|
||||
adapter: string,
|
||||
request: debug-request,
|
||||
initialize-args: option<string>,
|
||||
stop-on-entry: option<bool>,
|
||||
config: string,
|
||||
tcp-connection: option<tcp-arguments-template>,
|
||||
}
|
||||
|
||||
|
|
|
@ -134,6 +134,7 @@ world extension {
|
|||
export labels-for-completions: func(language-server-id: string, completions: list<completion>) -> result<list<option<code-label>>, string>;
|
||||
export labels-for-symbols: func(language-server-id: string, symbols: list<symbol>) -> result<list<option<code-label>>, string>;
|
||||
|
||||
|
||||
/// Returns the completions that should be shown when completing the provided slash command with the given query.
|
||||
export complete-slash-command-argument: func(command: slash-command, args: list<string>) -> result<list<slash-command-argument-completion>, string>;
|
||||
|
||||
|
@ -158,4 +159,6 @@ world extension {
|
|||
|
||||
/// Returns a configured debug adapter binary for a given debug task.
|
||||
export get-dap-binary: func(adapter-name: string, config: debug-task-definition, user-installed-path: option<string>, worktree: borrow<worktree>) -> result<debug-adapter-binary, string>;
|
||||
/// Get a debug adapter's configuration schema
|
||||
export dap-schema: func() -> result<string, string>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue