Add integration test and fix hovering over the wire

This commit is contained in:
Keith Simmons 2022-06-07 14:22:02 -07:00
parent a6c0ee472c
commit 1b66e1e185
8 changed files with 165 additions and 50 deletions

View file

@ -857,6 +857,9 @@ impl LspCommand for GetHover {
let mut current_text = String::new();
for event in Parser::new_ext(&markup_content.value, Options::all()) {
match event {
Event::SoftBreak => {
current_text.push(' ');
}
Event::Text(text) | Event::Code(text) => {
current_text.push_str(&text.to_string());
}
@ -875,7 +878,8 @@ impl LspCommand for GetHover {
Event::End(Tag::CodeBlock(_))
| Event::End(Tag::Paragraph)
| Event::End(Tag::Heading(_, _, _))
| Event::End(Tag::BlockQuote) => {
| Event::End(Tag::BlockQuote)
| Event::HardBreak => {
if !current_text.is_empty() {
let text = std::mem::replace(&mut current_text, String::new());
contents.push(HoverBlock { text, language });

View file

@ -219,7 +219,7 @@ pub struct Symbol {
pub signature: [u8; 32],
}
#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct HoverBlock {
pub text: String,
pub language: Option<String>,
@ -3766,10 +3766,8 @@ impl Project {
} else if let Some(project_id) = self.remote_id() {
let rpc = self.client.clone();
let message = request.to_proto(project_id, buffer);
dbg!(&message);
return cx.spawn(|this, cx| async move {
let response = rpc.request(message).await?;
dbg!(&response);
request
.response_from_proto(response, this, buffer_handle, cx)
.await