Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ep: Dont send type definition requests to tombi (#54676)
Ben Kunkle1b277fe2d02b
diff --git a/crates/edit_prediction_context/src/edit_prediction_context.rs b/crates/edit_prediction_context/src/edit_prediction_context.rsindex 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<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+ })+ })+}diff --git a/docs/src/languages/toml.md b/docs/src/languages/toml.mdindex 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).--<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>