-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: add option to preserve html entities #8501
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
base: main
Are you sure you want to change the base?
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.
I found some issues that need attention:
- executeCommandTool does not implement the "Claude always preserve" exception that other tools use. This makes behavior inconsistent with the description and could cause unintended unescaping for Claude. See inline comment for a minimal fix.
- The "Preserve HTML entities" checkbox is only rendered when "Always allow write" is enabled. This setting affects file edits and commands regardless of auto-approve write, so it should be accessible even when auto-approve write is off. See inline note.
Non-blocking suggestion: consider adding integration tests that assert applyDiff/writeToFile/executeCommand honor preserveHtmlEntities across models (Claude vs non-Claude) and both true/false states.
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 found some issues that need attention:
- SettingsView doesn’t persist the preserveHtmlEntities flag via the Save action. The checkbox posts immediately, which bypasses the Save/Discard flow. Recommend posting this value from handleSubmit as well.
- The immediate post in AutoApproveSettings causes Save/Discard inconsistency. Consider deferring persistence to Save for consistency.
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.
One maintainability suggestion identified; no additional blocking issues beyond existing comments.
// Only unescape HTML entities if: | ||
// 1. The setting is not explicitly set to preserve them, AND | ||
// 2. The model is not Claude (Claude handles entities correctly by default) | ||
if (diffContent && !preserveHtmlEntities && !cline.api.getModel().id.includes("claude")) { |
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.
[P3] The HTML-entity handling condition is duplicated across multiple tools (applyDiffTool, multiApplyDiffTool, writeToFileTool, executeCommandTool). Consider extracting a small shared helper, e.g., shouldUnescapeHtmlEntities({ preserveHtmlEntities, modelId }), to keep behavior consistent and prevent drift.
Related GitHub Issue
Closes: #8069
Roo Code Task Context (Optional)
Description
This PR adds a new setting to preserve html entities. Previously only Claude models does this, now the user has the option whether to preserve them or not.
Test Procedure
Check the difference when we enable/disable the option
Pre-Submission Checklist
Screenshots / Videos
We have this new setting in the auto-approve section.
Documentation Updates
Additional Notes
Get in Touch
@elianiva
Important
Adds a setting to control HTML entity preservation in file edits and commands, with UI updates and tests.
preserveHtmlEntities
boolean setting to control HTML entity preservation inglobal-settings.ts
.applyDiffToolLegacy()
,executeCommandTool()
,applyDiffTool()
, andwriteToFileTool()
to respectpreserveHtmlEntities
setting.preserveHtmlEntities
inAutoApproveSettings.tsx
andSettingsView.tsx
.preserveHtmlEntities
setting.html-entity-preservation.spec.ts
to test HTML entity handling.ClineProvider
andwebviewMessageHandler
to handlepreserveHtmlEntities
state.This description was created by
for 7782eef. You can customize this summary. It will automatically update as commits are pushed.