Fix rust-analyzer not enabling rust-analyzer spans on the proc-macro server

This commit is contained in:
Lukas Wirth 2024-02-22 22:32:39 +01:00
parent cdfb73ab9c
commit efa6948b57

View File

@ -45,7 +45,7 @@ impl ProcMacroProcessSrv {
}) })
}; };
let mut srv = create_srv(true)?; let mut srv = create_srv(true)?;
tracing::info!("sending version check"); tracing::info!("sending proc-macro server version check");
match srv.version_check() { match srv.version_check() {
Ok(v) if v > CURRENT_API_VERSION => Err(io::Error::new( Ok(v) if v > CURRENT_API_VERSION => Err(io::Error::new(
io::ErrorKind::Other, io::ErrorKind::Other,
@ -55,14 +55,15 @@ impl ProcMacroProcessSrv {
), ),
)), )),
Ok(v) => { Ok(v) => {
tracing::info!("got version {v}"); tracing::info!("Proc-macro server version: {v}");
srv = create_srv(false)?; srv = create_srv(false)?;
srv.version = v; srv.version = v;
if srv.version > RUST_ANALYZER_SPAN_SUPPORT { if srv.version >= RUST_ANALYZER_SPAN_SUPPORT {
if let Ok(mode) = srv.enable_rust_analyzer_spans() { if let Ok(mode) = srv.enable_rust_analyzer_spans() {
srv.mode = mode; srv.mode = mode;
} }
} }
tracing::info!("Proc-macro server span mode: {:?}", srv.mode);
Ok(srv) Ok(srv)
} }
Err(e) => { Err(e) => {