Allow language injection in markdown code blocks in channel notes
This commit is contained in:
parent
4cce6ae212
commit
2dd32dbe87
1 changed files with 10 additions and 10 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue