mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 23:25:03 +00:00
less verbose debug
This commit is contained in:
parent
94241cec04
commit
90f20f8c53
2 changed files with 45 additions and 8 deletions
|
@ -2,6 +2,7 @@ mod handlers;
|
|||
mod subscriptions;
|
||||
|
||||
use std::{
|
||||
fmt,
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
};
|
||||
|
@ -109,6 +110,43 @@ pub fn main_loop(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
enum Event {
|
||||
Msg(RawMessage),
|
||||
Task(Task),
|
||||
Vfs(VfsTask),
|
||||
Lib(LibraryData),
|
||||
}
|
||||
|
||||
impl fmt::Debug for Event {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let debug_verbose_not = |not: &RawNotification, f: &mut fmt::Formatter| {
|
||||
f.debug_struct("RawNotification")
|
||||
.field("method", ¬.method)
|
||||
.finish()
|
||||
};
|
||||
|
||||
match self {
|
||||
Event::Msg(RawMessage::Notification(not)) => {
|
||||
if not.is::<req::DidOpenTextDocument>() || not.is::<req::DidChangeTextDocument>() {
|
||||
return debug_verbose_not(not, f);
|
||||
}
|
||||
}
|
||||
Event::Task(Task::Notify(not)) => {
|
||||
if not.is::<req::PublishDecorations>() || not.is::<req::PublishDiagnostics>() {
|
||||
return debug_verbose_not(not, f);
|
||||
}
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
match self {
|
||||
Event::Msg(it) => fmt::Debug::fmt(it, f),
|
||||
Event::Task(it) => fmt::Debug::fmt(it, f),
|
||||
Event::Vfs(it) => fmt::Debug::fmt(it, f),
|
||||
Event::Lib(it) => fmt::Debug::fmt(it, f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main_loop_inner(
|
||||
internal_mode: bool,
|
||||
publish_decorations: bool,
|
||||
|
@ -123,13 +161,6 @@ fn main_loop_inner(
|
|||
) -> Result<()> {
|
||||
let (libdata_sender, libdata_receiver) = unbounded();
|
||||
loop {
|
||||
#[derive(Debug)]
|
||||
enum Event {
|
||||
Msg(RawMessage),
|
||||
Task(Task),
|
||||
Vfs(VfsTask),
|
||||
Lib(LibraryData),
|
||||
}
|
||||
log::trace!("selecting");
|
||||
let event = select! {
|
||||
recv(msg_receiver, msg) => match msg {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue