Skip to content

feat: add view code dialog#5335

Merged
OEvgeny merged 10 commits intomainfrom
feature/view-code-dialog
Oct 26, 2024
Merged

feat: add view code dialog#5335
OEvgeny merged 10 commits intomainfrom
feature/view-code-dialog

Conversation

@OEvgeny
Copy link
Copy Markdown
Collaborator

@OEvgeny OEvgeny commented Oct 25, 2024

Fixes #

Changelog Entry

  • Added code viewer dialog with syntax highlighting, in PR #5335, by @OEvgeny

Description

Adds a dialog to view code snippets with syntax highlighting in chat messages. The feature focuses on improving code readability and maintaining good performance through selective language imports.

Design

  • Dialog opens when clicking the code button
  • Uses Shiki for syntax highlighting with lazy loading
  • Supports JavaScript, TypeScript, and Python initially
  • Fetches code from the basedOn if available in Message metadata

Specific Changes

  • Added ActivityViewCodeButton and CodeContent components
  • Integrated Shiki with GitHub light/dark themes
  • Added code icon button to message footer
  • Added AI-generated code warning notice
  • Added test coverage and localization strings

-

  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • [] I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@OEvgeny OEvgeny marked this pull request as ready for review October 25, 2024 23:52
Comment thread __tests__/html/copyButton.hideAndShow.html Outdated
Comment thread packages/component/src/Attachment/Text/private/ActivityViewCodeButton.tsx Outdated
Comment thread packages/component/src/Attachment/Text/private/CodeContent.tsx Outdated
Comment thread packages/component/src/Attachment/Text/private/CodeContent.tsx Outdated
Comment thread packages/component/src/Attachment/Text/private/CodeContent.tsx
Comment thread packages/component/src/Attachment/Text/private/CodeContent.tsx Outdated
Comment thread packages/component/src/Attachment/Text/private/MarkdownTextContent.tsx Outdated
OEvgeny and others added 2 commits October 26, 2024 00:32
Co-authored-by: William Wong <compulim@users.noreply.github.com>
compulim
compulim previously approved these changes Oct 26, 2024
@OEvgeny OEvgeny enabled auto-merge (squash) October 26, 2024 01:02
@OEvgeny OEvgeny merged commit 558a7d6 into main Oct 26, 2024
@OEvgeny OEvgeny deleted the feature/view-code-dialog branch October 26, 2024 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants