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 ...
This commit is contained in:
Ben Kunkle 2026-04-23 12:03:41 -05:00 committed by GitHub
parent cf8eb424b0
commit 1b277fe2d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 27 deletions

View file

@ -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<Buffer>,
cx: &mut Context<Project>,
) -> 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
})
})
}

View file

@ -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).
<div class="warning">
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
}
}
}
```
</div>