-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Remove language selection and word wrap toggle from CodeBlock #8208
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
Conversation
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.
Found several cleanup opportunities that should be addressed to maintain code quality.
| import { useCopyToClipboard } from "@src/utils/clipboard" | ||
| import { getHighlighter, isLanguageLoaded, normalizeLanguage, ExtendedLanguage } from "@src/utils/highlighter" | ||
| import { bundledLanguages } from "shiki" | ||
| import { getHighlighter, isLanguageLoaded, normalizeLanguage } from "@src/utils/highlighter" |
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.
These unused imports should be removed:
WrapTextandAlignJustifyfrom lucide-react (no longer used after removing word wrap toggle)ExtendedLanguagefrom highlighter utils (no longer used after removing language selection)bundledLanguagesfrom shiki (was only used for the language dropdown)
| import { toJsxRuntime } from "hast-util-to-jsx-runtime" | ||
| import { Fragment, jsx, jsxs } from "react/jsx-runtime" | ||
| import { ChevronDown, ChevronUp, WrapText, AlignJustify, Copy, Check } from "lucide-react" | ||
| import { ChevronDown, ChevronUp, Copy, Check } from "lucide-react" |
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 ChevronDown, ChevronUp, Copy, Check imports from lucide-react should be cleaned up to remove the unused WrapText and AlignJustify icons:
| }: CodeBlockProps) => { | ||
| const [wordWrap, setWordWrap] = useState(initialWordWrap) | ||
| // Use word wrap from props, default to true | ||
| const wordWrap = initialWordWrap |
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.
Consider documenting why wordWrap is now effectively read-only. The component accepts initialWordWrap but users can no longer toggle it. If this is intentional, a comment explaining the design decision would be helpful.
|
Additionally, the i18n translations for 'enable_wrap' and 'disable_wrap' in all 18 language files (under webview-ui/src/i18n/locales/*/chat.json) are now unused and should be removed to keep the translation files clean. |
|
@roomote-agent remove the unused stuff please |
|
On it! I'll clean up the unused imports and code from the CodeBlock component. |
|
✅ Done! I've cleaned up the unused code from the CodeBlock component:
All tests are passing and CI checks have completed successfully. |
Important
Remove language selection and word wrap toggle from
CodeBlockcomponent, updating UI and translations accordingly.CodeBlockinCodeBlock.tsx.wordWrapis now a constant value set from props, defaulting to true.LanguageSelectcomponent and related state management fromCodeBlock.tsx.onLanguageChangeprop and related logic fromCodeBlock.tsx.locales/ca/chat.json,locales/de/chat.json, andlocales/en/chat.json.CodeBlock.spec.tsxto remove tests related to word wrap tooltips.This description was created by
for 0cb4d11. You can customize this summary. It will automatically update as commits are pushed.