Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rust playground link #258

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Guocork
Copy link
Collaborator

@Guocork Guocork commented Sep 20, 2024

On hold until we have the ability to wrap the code blocks within the Markdown element, in separate views (where we can place actions). Currently this PR adds the link at the end of the message and only works for the first code block.

@joulei
Copy link
Collaborator

joulei commented Sep 23, 2024

Hi @Guocork, @jmbejar mentioned that the link does not show very clearly what it's doing, and maybe placement is not the best.

@Guocork the icon you're using is used for sharing content, it usually opens an option panel or copies a link.

Instead, this icon is used more commonly for external links (navigates outside of the current context). We should either use something like this or a rust logo.
image

And to make it more clear, we can use a tooltip on hover (similar to the tooltips used in the right panel) with a message like "Open in Rust Playground". You can check how tooltips are used in src/chat/chat_params.rs.

Besides that, one current limitation (in this PR) is that this would copy the first code block in a markdown message. If the message has multiple code blocks, the rest are ignored.
The only solution to this I think is to have the link next to each code block, similar to what other platforms do:

image

However this would require writing our own custom widget similar to the original Markdown widget, with the added logic to render the code blocks differently with an added actions section to it. This seems like a complex task.

@jmbejar should we leave this PR on hold until we have support for that?

@jmbejar
Copy link
Collaborator

jmbejar commented Sep 23, 2024

However this would require writing our own custom widget similar to the original Markdown widget, with the added logic to render the code blocks differently with an added actions section to it. This seems like a complex task.

@jmbejar should we leave this PR on hold until we have support for that?

Correct, we don't have any related ability in the Markdown widget yet, so it is hard to implement this feature in a good-looking way.
Let me check how hard is to have something in the markdown widget to properly cover this case. In the meantime, let's hold this PR but the idea will be to give @Guocork the tools to complete it 👍

@joulei joulei marked this pull request as draft September 25, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants