Fix some completion docs render delays (#31486)
Closes #31460 While this is now much better than it was, the documentation still flickers when changing selection. Hoping to fix that, but it will be a much more involved change. So leaving release notes as "N/A" for now, in anticipation of the full fix. Release Notes: - N/A
This commit is contained in:
parent
450a10facf
commit
0d3fad7764
4 changed files with 41 additions and 30 deletions
|
@ -646,7 +646,7 @@ impl CompletionsMenu {
|
|||
} => div().child(text.clone()),
|
||||
CompletionDocumentation::MultiLineMarkdown(parsed) if !parsed.is_empty() => {
|
||||
let markdown = self.markdown_element.get_or_insert_with(|| {
|
||||
cx.new(|cx| {
|
||||
let markdown = cx.new(|cx| {
|
||||
let languages = editor
|
||||
.workspace
|
||||
.as_ref()
|
||||
|
@ -656,11 +656,19 @@ impl CompletionsMenu {
|
|||
.language_at(self.initial_position, cx)
|
||||
.map(|l| l.name().to_proto());
|
||||
Markdown::new(SharedString::default(), languages, language, cx)
|
||||
})
|
||||
});
|
||||
// Handles redraw when the markdown is done parsing. The current render is for a
|
||||
// deferred draw and so was not getting redrawn when `markdown` notified.
|
||||
cx.observe(&markdown, |_, _, cx| cx.notify()).detach();
|
||||
markdown
|
||||
});
|
||||
markdown.update(cx, |markdown, cx| {
|
||||
let is_parsing = markdown.update(cx, |markdown, cx| {
|
||||
markdown.reset(parsed.clone(), cx);
|
||||
markdown.is_parsing()
|
||||
});
|
||||
if is_parsing {
|
||||
return None;
|
||||
}
|
||||
div().child(
|
||||
MarkdownElement::new(markdown.clone(), hover_markdown_style(window, cx))
|
||||
.code_block_renderer(markdown::CodeBlockRenderer::Default {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue