mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 15:44:31 +03:00
Allow language injection in markdown code blocks in channel notes (#3231)
Release Notes: - Fixed an issue where markdown code blocks were not syntax-highlighted in channel notes editors.
This commit is contained in:
commit
42409528af
@ -75,23 +75,23 @@ impl ChannelView {
|
|||||||
let workspace = workspace.read(cx);
|
let workspace = workspace.read(cx);
|
||||||
let project = workspace.project().to_owned();
|
let project = workspace.project().to_owned();
|
||||||
let channel_store = ChannelStore::global(cx);
|
let channel_store = ChannelStore::global(cx);
|
||||||
let markdown = workspace
|
let language_registry = workspace.app_state().languages.clone();
|
||||||
.app_state()
|
let markdown = language_registry.language_for_name("Markdown");
|
||||||
.languages
|
|
||||||
.language_for_name("Markdown");
|
|
||||||
let channel_buffer =
|
let channel_buffer =
|
||||||
channel_store.update(cx, |store, cx| store.open_channel_buffer(channel_id, cx));
|
channel_store.update(cx, |store, cx| store.open_channel_buffer(channel_id, cx));
|
||||||
|
|
||||||
cx.spawn(|mut cx| async move {
|
cx.spawn(|mut cx| async move {
|
||||||
let channel_buffer = channel_buffer.await?;
|
let channel_buffer = channel_buffer.await?;
|
||||||
|
let markdown = markdown.await.log_err();
|
||||||
|
|
||||||
if let Some(markdown) = markdown.await.log_err() {
|
channel_buffer.update(&mut cx, |buffer, cx| {
|
||||||
channel_buffer.update(&mut cx, |buffer, cx| {
|
buffer.buffer().update(cx, |buffer, cx| {
|
||||||
buffer.buffer().update(cx, |buffer, cx| {
|
buffer.set_language_registry(language_registry);
|
||||||
|
if let Some(markdown) = markdown {
|
||||||
buffer.set_language(Some(markdown), cx);
|
buffer.set_language(Some(markdown), cx);
|
||||||
})
|
}
|
||||||
});
|
})
|
||||||
}
|
});
|
||||||
|
|
||||||
pane.update(&mut cx, |pane, cx| {
|
pane.update(&mut cx, |pane, cx| {
|
||||||
let buffer_id = channel_buffer.read(cx).remote_id(cx);
|
let buffer_id = channel_buffer.read(cx).remote_id(cx);
|
||||||
|
Loading…
Reference in New Issue
Block a user