From 1f2c9d7c47721a6bbfc85c4d5ef19d213e332ca0 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 12 Feb 2025 17:55:33 +0100 Subject: [PATCH] Capabilities for LSP extensions (#1340) Clients sending textDocument/build to a server that doesn't support it may receive an error. In a multi-server setup, users expect to send the message only to servers that support it. Add a capability to enable this use case. Closes #1328 --- crates/texlab/src/server.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/texlab/src/server.rs b/crates/texlab/src/server.rs index a42939ae..5bac5d22 100644 --- a/crates/texlab/src/server.rs +++ b/crates/texlab/src/server.rs @@ -23,6 +23,7 @@ use notify_debouncer_full::{DebouncedEvent, Debouncer, RecommendedCache}; use parking_lot::{Mutex, RwLock}; use rustc_hash::FxHashSet; use serde::{de::DeserializeOwned, Serialize}; +use serde_json::{Map, Value}; use threadpool::ThreadPool; use crate::{ @@ -174,6 +175,13 @@ impl Server { ..Default::default() }), inlay_hint_provider: Some(OneOf::Left(true)), + experimental: Some(Value::Object(Map::from_iter( + [ + ("textDocumentBuild".to_string(), Value::Bool(true)), + ("textDocumentForwardSearch".to_string(), Value::Bool(true)), + ] + .into_iter(), + ))), ..ServerCapabilities::default() } }