debugger: Rework language association with the debuggers (#29945)

- Languages now define their preferred debuggers in `config.toml`.
- `LanguageRegistry` now exposes language config even for languages that
are not yet loaded. This necessitated extension registry changes (we now
deserialize config.toml of all language entries when loading new
extension index), but it should be backwards compatible with the old
format. /cc @maxdeviant

Release Notes:

- N/A

---------

Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Remco Smits <djsmits12@gmail.com>
Co-authored-by: Anthony <anthony@zed.dev>
This commit is contained in:
Piotr Osiewicz
2025-05-06 20:16:41 +02:00
committed by GitHub
co-authored by Anthony Eid Remco Smits Anthony
parent 544e8fc46c
commit 09d3ff9dbe
27 changed files with 386 additions and 216 deletions
+1
View File
@@ -11,3 +11,4 @@ brackets = [
{ start = "'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
{ start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] },
]
debuggers = ["CodeLLDB", "GDB"]
+1
View File
@@ -11,3 +11,4 @@ brackets = [
{ start = "'", end = "'", close = true, newline = false, not_in = ["string", "comment"] },
{ start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] },
]
debuggers = ["CodeLLDB", "GDB"]
-4
View File
@@ -630,10 +630,6 @@ impl ContextProvider for GoContextProvider {
},
]))
}
fn debug_adapter(&self) -> Option<String> {
Some("Delve".into())
}
}
fn extract_subtest_name(input: &str) -> Option<String> {
+1
View File
@@ -14,3 +14,4 @@ brackets = [
]
tab_size = 4
hard_tabs = true
debuggers = ["Delve"]
@@ -19,6 +19,7 @@ word_characters = ["$", "#"]
tab_size = 2
scope_opt_in_language_servers = ["tailwindcss-language-server", "emmet-language-server"]
prettier_parser_name = "babel"
debuggers = ["JavaScript"]
[jsx_tag_auto_close]
open_tag_node_name = "jsx_opening_element"
+1 -4
View File
@@ -325,10 +325,7 @@ fn register_language(
languages.register_lsp_adapter(config.name.clone(), adapter);
}
languages.register_language(
config.name.clone(),
config.grammar.clone(),
config.matcher.clone(),
config.hidden,
config.clone(),
Arc::new(move || {
Ok(LoadedLanguage {
config: config.clone(),
-4
View File
@@ -474,10 +474,6 @@ impl ContextProvider for PythonContextProvider {
Some(TaskTemplates(tasks))
}
fn debug_adapter(&self) -> Option<String> {
Some("Debugpy".into())
}
}
fn selected_test_runner(location: Option<&Arc<dyn language::File>>, cx: &App) -> TestRunner {
+1
View File
@@ -29,3 +29,4 @@ brackets = [
auto_indent_using_last_non_empty_line = false
increase_indent_pattern = "^[^#].*:\\s*$"
decrease_indent_pattern = "^\\s*(else|elif|except|finally)\\b.*:"
debuggers = ["Debugpy"]
-4
View File
@@ -803,10 +803,6 @@ impl ContextProvider for RustContextProvider {
fn lsp_task_source(&self) -> Option<LanguageServerName> {
Some(SERVER_NAME)
}
fn debug_adapter(&self) -> Option<String> {
Some("CodeLLDB".to_owned())
}
}
/// Part of the data structure of Cargo metadata
+1
View File
@@ -15,3 +15,4 @@ brackets = [
{ start = "/*", end = " */", close = true, newline = false, not_in = ["string", "comment"] },
]
collapsed_placeholder = " /* ... */ "
debuggers = ["CodeLLDB", "GDB"]
+1
View File
@@ -17,6 +17,7 @@ word_characters = ["#", "$"]
scope_opt_in_language_servers = ["tailwindcss-language-server", "emmet-language-server"]
prettier_parser_name = "typescript"
tab_size = 2
debuggers = ["JavaScript"]
[jsx_tag_auto_close]
open_tag_node_name = "jsx_opening_element"
@@ -17,6 +17,7 @@ brackets = [
word_characters = ["#", "$"]
prettier_parser_name = "typescript"
tab_size = 2
debuggers = ["JavaScript"]
[overrides.string]
completion_query_characters = ["."]