Skip to content

Add QOL features to tool call code#5

Merged
ScriptSmith merged 2 commits intomainfrom
tool-syntax-highlighting
Mar 4, 2026
Merged

Add QOL features to tool call code#5
ScriptSmith merged 2 commits intomainfrom
tool-syntax-highlighting

Conversation

@ScriptSmith
Copy link
Owner

No description provided.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 4, 2026

Greptile Summary

This PR introduces a new shared HighlightedCode component using Shiki for syntax highlighting, consolidating duplicate code highlighting logic across CodeArtifact, HtmlArtifact, and ToolExecutionStep components.

Key Changes:

  • Created reusable HighlightedCode component with Shiki integration for syntax highlighting
  • Refactored CodeArtifact and HtmlArtifact to use the new component, removing ~50 lines of duplicate code
  • Enhanced ToolExecutionStep with improved inline code preview UI featuring a header, better expand/collapse UX, and syntax highlighting
  • Updated Storybook tests to handle syntax-highlighted text split across spans
  • Added comprehensive Storybook stories for the new component

Issues Found:

  • Missing error handling in clipboard copy function - unhandled promise rejections will occur if clipboard API fails

Confidence Score: 4/5

  • This PR is safe to merge with one minor error handling issue that should be addressed
  • The refactoring is well-executed with good code reuse, proper cleanup patterns, and comprehensive tests. The only issue is missing error handling in the clipboard copy function, which could cause unhandled promise rejections but won't break functionality.
  • Pay attention to ui/src/components/HighlightedCode/HighlightedCode.tsx - add error handling to the copy function before merging

Important Files Changed

Filename Overview
ui/src/components/HighlightedCode/HighlightedCode.tsx New shared component for syntax-highlighted code using Shiki. Missing error handling in clipboard copy function.
ui/src/components/Artifact/CodeArtifact.tsx Refactored to use HighlightedCode component, removing duplicate code. Clean simplification.
ui/src/components/ToolExecution/ToolExecutionStep.tsx Enhanced inline code preview with improved UI, header, and syntax highlighting support via HighlightedCode.

Last reviewed commit: a57fbc5

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@ScriptSmith ScriptSmith merged commit babf1a1 into main Mar 4, 2026
19 checks passed
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.

1 participant