-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add copy-to-clipboard fix prompt to Mermaid error notice #2
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
feat: Add copy-to-clipboard fix prompt to Mermaid error notice #2
Conversation
Summary of ChangesHello @harley, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience when encountering Mermaid diagram rendering errors by providing an immediate, context-aware 'Copy fix prompt' action. This feature allows users to efficiently leverage AI tools like ChatGPT to correct their Mermaid syntax, thereby streamlining the debugging and correction process. The implementation includes robust clipboard handling and a clear display of the generated prompt for manual intervention if automated copying fails. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a helpful "Copy fix prompt" feature for Mermaid error notices, which is a great user experience enhancement. The implementation is solid, including a robust copy-to-clipboard helper with a fallback. My review includes a few suggestions to improve maintainability and robustness, such as handling a potential race condition with setTimeout and extracting hardcoded values into constants.
| setTimeout(() => { | ||
| promptButton.disabled = false | ||
| promptButton.textContent = defaultLabel | ||
| }, 2000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The callback for this setTimeout could execute after the promptButton has been removed from the DOM (e.g., if the user navigates away or settings change). This can lead to unnecessary work. To make this more robust, you should check if the button is still connected to the DOM before attempting to modify it.
setTimeout(() => {
if (!promptButton.isConnected) return
promptButton.disabled = false
promptButton.textContent = defaultLabel
}, 2000)| promptPreview.style.fontFamily = | ||
| 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| setTimeout(() => { | ||
| promptButton.disabled = false | ||
| promptButton.textContent = defaultLabel | ||
| }, 2000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤖 I have created a release *beep* *boop* --- ## [1.1.0](v1.0.0...v1.1.0) (2025-09-29) ### Features * Add copy-to-clipboard fix prompt to Mermaid error notice ([#2](#2)) ([7fb5785](7fb5785)) * add diagram/code toggles for Mermaid blocks ([#7](#7)) ([90c460f](90c460f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
Testing
https://chatgpt.com/codex/tasks/task_b_68d6dada1980832b8978aa84ebc4b833