Fixed proc macro server error

This commit is contained in:
2026-06-26 17:06:53 +02:00
parent a37dffb94b
commit b6b5214684
+7 -6
View File
@@ -103,7 +103,8 @@ impl RustAnalyzer {
pub fn new( pub fn new(
notification_tx: tokio::sync::mpsc::UnboundedSender<Value>, notification_tx: tokio::sync::mpsc::UnboundedSender<Value>,
) -> Result<Self, Box<dyn std::error::Error + Send + Sync>> { ) -> Result<Self, Box<dyn std::error::Error + Send + Sync>> {
let mut child = tokio::process::Command::new("rust-analyzer") let mut child = tokio::process::Command::new("rustup")
.args(["run", "stable", "rust-analyzer"])
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stdout(Stdio::piped()) .stdout(Stdio::piped())
.stderr(Stdio::piped()) .stderr(Stdio::piped())
@@ -129,7 +130,10 @@ impl RustAnalyzer {
match stderr.read(&mut buf).await { match stderr.read(&mut buf).await {
Ok(0) => break, Ok(0) => break,
Ok(n) => { Ok(n) => {
eprintln!("[ra-stderr] {}", String::from_utf8_lossy(&buf[..n]).trim_end()); eprintln!(
"[ra-stderr] {}",
String::from_utf8_lossy(&buf[..n]).trim_end()
);
} }
Err(e) => { Err(e) => {
eprintln!("[ra-stderr] read error: {e}"); eprintln!("[ra-stderr] read error: {e}");
@@ -323,10 +327,7 @@ impl RustAnalyzer {
} }
pub async fn initialized(&mut self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> { pub async fn initialized(&mut self) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
self.notify( self.notify(<Initialized as Notification>::METHOD, InitializedParams {})
<Initialized as Notification>::METHOD,
InitializedParams {},
)
.await?; .await?;
Ok(()) Ok(())
} }