mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Rename feedback to show_message
This commit is contained in:
parent
80347b8187
commit
ce118da149
3 changed files with 13 additions and 13 deletions
|
@ -63,7 +63,7 @@ pub fn main_loop(
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::error!("loading workspace failed: {}", e);
|
log::error!("loading workspace failed: {}", e);
|
||||||
|
|
||||||
feedback(
|
show_message(
|
||||||
req::MessageType::Error,
|
req::MessageType::Error,
|
||||||
format!("rust-analyzer failed to load workspace: {}", e),
|
format!("rust-analyzer failed to load workspace: {}", e),
|
||||||
msg_sender,
|
msg_sender,
|
||||||
|
@ -247,7 +247,7 @@ fn main_loop_inner(
|
||||||
&& pending_libraries.is_empty()
|
&& pending_libraries.is_empty()
|
||||||
&& in_flight_libraries == 0
|
&& in_flight_libraries == 0
|
||||||
{
|
{
|
||||||
feedback(req::MessageType::Info, "workspace loaded", msg_sender);
|
show_message(req::MessageType::Info, "workspace loaded", msg_sender);
|
||||||
// Only send the notification first time
|
// Only send the notification first time
|
||||||
send_workspace_notification = false;
|
send_workspace_notification = false;
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ fn update_file_notifications_on_threadpool(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn feedback<M: Into<String>>(typ: req::MessageType, msg: M, sender: &Sender<RawMessage>) {
|
fn show_message<M: Into<String>>(typ: req::MessageType, msg: M, sender: &Sender<RawMessage>) {
|
||||||
let not = RawNotification::new::<req::ShowMessage>(&req::ShowMessageParams {
|
let not = RawNotification::new::<req::ShowMessage>(&req::ShowMessageParams {
|
||||||
typ,
|
typ,
|
||||||
message: msg.into(),
|
message: msg.into(),
|
||||||
|
|
|
@ -31,7 +31,7 @@ version = "0.0.0"
|
||||||
use std::collections::Spam;
|
use std::collections::Spam;
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
server.wait_for_feedback("workspace loaded");
|
server.wait_for_message("workspace loaded");
|
||||||
eprintln!("loading took {:?}", project_start.elapsed());
|
eprintln!("loading took {:?}", project_start.elapsed());
|
||||||
let completion_start = Instant::now();
|
let completion_start = Instant::now();
|
||||||
let res = server.send_request::<Completion>(CompletionParams {
|
let res = server.send_request::<Completion>(CompletionParams {
|
||||||
|
@ -53,7 +53,7 @@ fn foo() {
|
||||||
}
|
}
|
||||||
",
|
",
|
||||||
);
|
);
|
||||||
server.wait_for_feedback("workspace loaded");
|
server.wait_for_message("workspace loaded");
|
||||||
server.request::<Runnables>(
|
server.request::<Runnables>(
|
||||||
RunnablesParams { text_document: server.doc_id("lib.rs"), position: None },
|
RunnablesParams { text_document: server.doc_id("lib.rs"), position: None },
|
||||||
json!([
|
json!([
|
||||||
|
@ -107,7 +107,7 @@ pub fn foo() {}
|
||||||
fn test_eggs() {}
|
fn test_eggs() {}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
server.wait_for_feedback("workspace loaded");
|
server.wait_for_message("workspace loaded");
|
||||||
server.request::<Runnables>(
|
server.request::<Runnables>(
|
||||||
RunnablesParams {
|
RunnablesParams {
|
||||||
text_document: server.doc_id("tests/spam.rs"),
|
text_document: server.doc_id("tests/spam.rs"),
|
||||||
|
@ -167,7 +167,7 @@ fn main() {
|
||||||
pub use std::collections::HashMap;
|
pub use std::collections::HashMap;
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
server.wait_for_feedback("workspace loaded");
|
server.wait_for_message("workspace loaded");
|
||||||
|
|
||||||
server.request::<Formatting>(
|
server.request::<Formatting>(
|
||||||
DocumentFormattingParams {
|
DocumentFormattingParams {
|
||||||
|
@ -216,7 +216,7 @@ mod bar;
|
||||||
fn main() {}
|
fn main() {}
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
server.wait_for_feedback("workspace loaded");
|
server.wait_for_message("workspace loaded");
|
||||||
let empty_context = || CodeActionContext { diagnostics: Vec::new(), only: None };
|
let empty_context = || CodeActionContext { diagnostics: Vec::new(), only: None };
|
||||||
server.request::<CodeActionRequest>(
|
server.request::<CodeActionRequest>(
|
||||||
CodeActionParams {
|
CodeActionParams {
|
||||||
|
|
|
@ -134,14 +134,14 @@ impl Server {
|
||||||
}
|
}
|
||||||
panic!("no response");
|
panic!("no response");
|
||||||
}
|
}
|
||||||
pub fn wait_for_feedback(&self, feedback: &str) {
|
pub fn wait_for_message(&self, message: &str) {
|
||||||
self.wait_for_feedback_n(feedback, 1)
|
self.wait_for_message_n(message, 1)
|
||||||
}
|
}
|
||||||
pub fn wait_for_feedback_n(&self, feedback: &str, n: usize) {
|
pub fn wait_for_message_n(&self, message: &str, n: usize) {
|
||||||
let f = |msg: &RawMessage| match msg {
|
let f = |msg: &RawMessage| match msg {
|
||||||
RawMessage::Notification(n) if n.method == ShowMessage::METHOD => {
|
RawMessage::Notification(n) if n.method == ShowMessage::METHOD => {
|
||||||
let message = n.clone().cast::<req::ShowMessage>().unwrap();
|
let msg = n.clone().cast::<req::ShowMessage>().unwrap();
|
||||||
message.message == feedback
|
msg.message == message
|
||||||
}
|
}
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue