Rename feedback to show_message

This commit is contained in:
Ville Penttinen 2019-03-05 22:25:24 +02:00
parent 80347b8187
commit ce118da149
3 changed files with 13 additions and 13 deletions

View file

@ -63,7 +63,7 @@ pub fn main_loop(
Err(e) => {
log::error!("loading workspace failed: {}", e);
feedback(
show_message(
req::MessageType::Error,
format!("rust-analyzer failed to load workspace: {}", e),
msg_sender,
@ -247,7 +247,7 @@ fn main_loop_inner(
&& pending_libraries.is_empty()
&& 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
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 {
typ,
message: msg.into(),

View file

@ -31,7 +31,7 @@ version = "0.0.0"
use std::collections::Spam;
"#,
);
server.wait_for_feedback("workspace loaded");
server.wait_for_message("workspace loaded");
eprintln!("loading took {:?}", project_start.elapsed());
let completion_start = Instant::now();
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>(
RunnablesParams { text_document: server.doc_id("lib.rs"), position: None },
json!([
@ -107,7 +107,7 @@ pub fn foo() {}
fn test_eggs() {}
"#,
);
server.wait_for_feedback("workspace loaded");
server.wait_for_message("workspace loaded");
server.request::<Runnables>(
RunnablesParams {
text_document: server.doc_id("tests/spam.rs"),
@ -167,7 +167,7 @@ fn main() {
pub use std::collections::HashMap;
"#,
);
server.wait_for_feedback("workspace loaded");
server.wait_for_message("workspace loaded");
server.request::<Formatting>(
DocumentFormattingParams {
@ -216,7 +216,7 @@ mod bar;
fn main() {}
"#,
);
server.wait_for_feedback("workspace loaded");
server.wait_for_message("workspace loaded");
let empty_context = || CodeActionContext { diagnostics: Vec::new(), only: None };
server.request::<CodeActionRequest>(
CodeActionParams {

View file

@ -134,14 +134,14 @@ impl Server {
}
panic!("no response");
}
pub fn wait_for_feedback(&self, feedback: &str) {
self.wait_for_feedback_n(feedback, 1)
pub fn wait_for_message(&self, message: &str) {
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 {
RawMessage::Notification(n) if n.method == ShowMessage::METHOD => {
let message = n.clone().cast::<req::ShowMessage>().unwrap();
message.message == feedback
let msg = n.clone().cast::<req::ShowMessage>().unwrap();
msg.message == message
}
_ => false,
};