markdown: Don't retain MarkdownStyle in favor of using MarkdownElement directly (#28255)
This PR removes the retained `MarkdownStyle` on the `Markdown` entity in favor of using the `MarkdownElement` directly and passing the `MarkdownStyle` to it. This makes it so switching themes will be reflected live in the code block styles. Release Notes: - N/A --------- Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Agus Zubiaga <hi@aguz.me>
This commit is contained in:
co-authored by
Antonio Scandurra
Agus Zubiaga
parent
aa026156f2
commit
b6ee367ee0
@@ -7,7 +7,7 @@ use gpui::{
|
||||
};
|
||||
use language::Buffer;
|
||||
use language::CodeLabel;
|
||||
use markdown::Markdown;
|
||||
use markdown::{Markdown, MarkdownElement};
|
||||
use multi_buffer::{Anchor, ExcerptId};
|
||||
use ordered_float::OrderedFloat;
|
||||
use project::CompletionSource;
|
||||
@@ -622,21 +622,18 @@ impl CompletionsMenu {
|
||||
let language = editor
|
||||
.language_at(self.initial_position, cx)
|
||||
.map(|l| l.name().to_proto());
|
||||
Markdown::new(
|
||||
SharedString::default(),
|
||||
hover_markdown_style(window, cx),
|
||||
languages,
|
||||
language,
|
||||
cx,
|
||||
)
|
||||
.copy_code_block_buttons(false)
|
||||
.open_url(open_markdown_url)
|
||||
Markdown::new(SharedString::default(), languages, language, cx)
|
||||
.copy_code_block_buttons(false)
|
||||
.open_url(open_markdown_url)
|
||||
})
|
||||
});
|
||||
markdown.update(cx, |markdown, cx| {
|
||||
markdown.reset(parsed.clone(), cx);
|
||||
});
|
||||
div().child(markdown.clone())
|
||||
div().child(MarkdownElement::new(
|
||||
markdown.clone(),
|
||||
hover_markdown_style(window, cx),
|
||||
))
|
||||
}
|
||||
CompletionDocumentation::MultiLineMarkdown(_) => return None,
|
||||
CompletionDocumentation::SingleLine(_) => return None,
|
||||
|
||||
Reference in New Issue
Block a user