Correctly handle file links in markdown and agent threads (#56024)
Closes https://github.com/zed-industries/zed/issues/54840 There are likely more places we can use this new workspace function in, but these are the known ones to me right now Release Notes: - Fixed file hyperlinks in the agent panel not opening files when clicked Co-authored-by: saberoueslati <saberoueslati12@gmail.com>
This commit is contained in:
1 parent
b7b5d0c1a0
commit
84ebc5be71
10 files changed
+292
-108
No files matched your search
@@ -1256,6 +1256,7 @@ impl CompletionsMenu {
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Editor>,
|
||||
) -> Div {
|
||||
let editor = cx.weak_entity();
|
||||
div().child(
|
||||
MarkdownElement::new(markdown, hover_markdown_style(window, cx))
|
||||
.code_block_renderer(markdown::CodeBlockRenderer::Default {
|
||||
@@ -1263,7 +1264,17 @@ impl CompletionsMenu {
|
||||
wrap_button_visibility: markdown::WrapButtonVisibility::Hidden,
|
||||
border: false,
|
||||
})
|
||||
.on_url_click(open_markdown_url),
|
||||
.on_url_click(move |link, window, cx| {
|
||||
open_markdown_url(
|
||||
editor
|
||||
.read_with(cx, |editor, _| editor.workspace())
|
||||
.ok()
|
||||
.flatten(),
|
||||
link,
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user