From 1b277fe2d02be35cb1c7cb3ca11f7381e487f6fa Mon Sep 17 00:00:00 2001 From: Ben Kunkle Date: Thu, 23 Apr 2026 12:03:41 -0500 Subject: [PATCH] ep: Dont send type definition requests to tombi (#54676) Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes #ISSUE Release Notes: - N/A or Added/Fixed/Improved ... --- .../src/edit_prediction_context.rs | 25 +++++++++++++++++ docs/src/languages/toml.md | 27 ------------------- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/crates/edit_prediction_context/src/edit_prediction_context.rs b/crates/edit_prediction_context/src/edit_prediction_context.rs index 1858c87c744..bbd12dec4e3 100644 --- a/crates/edit_prediction_context/src/edit_prediction_context.rs +++ b/crates/edit_prediction_context/src/edit_prediction_context.rs @@ -289,6 +289,11 @@ impl RelatedExcerptStore { .ok()?; let type_definitions = project .update(cx, |project, cx| { + // tombi LSP for toml will open a scratch buffer with the JSON schema of + // the toml file when a goto type definition is requested + if is_tombi_lsp_in_toml(project, &buffer, cx) { + return Task::ready(Ok(None)); + } project.type_definitions(&buffer, identifier.range.start, cx) }) .ok()?; @@ -723,3 +728,23 @@ fn is_tsx_tag(buffer: &BufferSnapshot, node: &tree_sitter::Node) -> bool { } true } + +fn is_tombi_lsp_in_toml( + project: &Project, + buffer: &Entity, + cx: &mut Context, +) -> bool { + buffer.update(cx, |buffer, cx| { + if !buffer.language().is_some_and(|lang| lang.name() == "TOML") { + return false; + } + project.lsp_store().update(cx, |lsp_store, cx| { + for (_, lsp) in lsp_store.running_language_servers_for_local_buffer(buffer, cx) { + if "tombi".eq_ignore_ascii_case(lsp.name().as_ref()) { + return true; + } + } + false + }) + }) +} diff --git a/docs/src/languages/toml.md b/docs/src/languages/toml.md index 7cfd08a3310..df4f2cb9486 100644 --- a/docs/src/languages/toml.md +++ b/docs/src/languages/toml.md @@ -9,31 +9,4 @@ TOML support is available through the [TOML extension](https://zed.dev/extension - Tree-sitter: [tree-sitter/tree-sitter-toml](https://github.com/tree-sitter/tree-sitter-toml) -## Language server - A TOML language server is available in the [Tombi extension](https://zed.dev/extensions/tombi). - -
- -Tombi replies to language server requests for definitions by opening a scratch JSON buffer with the schema definition for some known formats (`Cargo.toml`, `pyproject.toml`, ...). Since [Edit Predictions](/docs/ai/edit-prediction) rely on looking up definitions, this leads to tabs opening when you edit the TOML file. - -You can fix it by [disabling definition requests](https://tombi-toml.github.io/tombi/docs/configuration/#lsp-goto-definition-enabled) in your Tombi configuration: - -```toml -[lsp] -goto-type-definition.enabled = false -``` - -Alternatively, you can disable edit predictions in TOML buffers: - -```json -{ - "languages": { - "TOML": { - "show_edit_predictions": false // https://github.com/tombi-toml/tombi/issues/1556 - } - } -} -``` - -