Skip to content

Commit f015429

Browse files
committed
internal: add rust-analyzer version to panic context
1 parent a12f037 commit f015429

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

crates/rust-analyzer/src/dispatch.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ impl<'a> RequestDispatcher<'a> {
3333
let world = panic::AssertUnwindSafe(&mut *self.global_state);
3434

3535
let response = panic::catch_unwind(move || {
36-
let _pctx = stdx::panic_context::enter(format!("request: {} {:#?}", R::METHOD, params));
36+
let _pctx = stdx::panic_context::enter(format!(
37+
"\nversion: {}\nrequest: {} {:#?}",
38+
env!("REV"),
39+
R::METHOD,
40+
params
41+
));
3742
let result = f(world.0, params);
3843
result_to_response::<R>(id, result)
3944
})
@@ -61,8 +66,12 @@ impl<'a> RequestDispatcher<'a> {
6166
let world = self.global_state.snapshot();
6267

6368
move || {
64-
let _pctx =
65-
stdx::panic_context::enter(format!("request: {} {:#?}", R::METHOD, params));
69+
let _pctx = stdx::panic_context::enter(format!(
70+
"\nversion: {}\nrequest: {} {:#?}",
71+
env!("REV"),
72+
R::METHOD,
73+
params
74+
));
6675
let result = f(world, params);
6776
Task::Response(result_to_response::<R>(id, result))
6877
}
@@ -166,7 +175,11 @@ impl<'a> NotificationDispatcher<'a> {
166175
return Ok(self);
167176
}
168177
};
169-
let _pctx = stdx::panic_context::enter(format!("notification: {}", N::METHOD));
178+
let _pctx = stdx::panic_context::enter(format!(
179+
"\nversion: {}\nnotification: {}",
180+
env!("REV"),
181+
N::METHOD
182+
));
170183
f(self.global_state, params)?;
171184
Ok(self)
172185
}

0 commit comments

Comments
 (0)