mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +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) => {
|
||||
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(),
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue