Skip to content

Conversation

@cannuri
Copy link
Contributor

@cannuri cannuri commented May 15, 2025

Description

This PR addresses several issues related to file reading functionality and improves the user experience when working with large files and line range notifications:

Closes #3351

  1. Added tooltips for truncation messages:

    • Before: When a file was truncated due to size limits, there was no tooltip on the truncation message to guide users on how to adjust this setting.
    • Fix: Added an informative tooltip to the info icon next to the truncation message, explaining how to adjust the file read auto-truncate threshold in settings.
    • Implementation: Created the necessary translation infrastructure by adding the missing tools.json files to the webview-ui directory for all supported languages, ensuring consistent translations across both components of the application.
  2. Enhanced readFileTool with improved auto-truncate handling:

    • Before: The wasAutoTruncated flag was not being set correctly, leading to inconsistent UI behavior when files were truncated.
    • Fix: Improved the logic for setting the wasAutoTruncated flag to ensure it's only set when a file is actually truncated due to the maxReadFileLine setting, not when the user explicitly requests a range of lines.
  3. Improved line range notifications:

    • Before: Line range notifications were only displayed in certain conditions based on the maxReadFileLine setting, leading to inconsistent UI feedback.
    • Fix: Modified the readFileTool to always display line range notifications regardless of the maxReadFileLine setting, making the UI more consistent and informative.
  4. Hidden truncation messages for explicit line range reads:

    • Before: Truncation messages were shown even for explicit line range reads, which was confusing since the user had intentionally specified the range.
    • Fix: When users explicitly specify line ranges, the truncation message is now hidden since it's not relevant in those cases.
  5. UI improvements:

    • Enhancement: Added a clear visual indicator (info icon) that additional information is available about file truncation.
    • Enhancement: The tooltip uses variables to reference other translations (settings, context, and threshold), ensuring consistency across the UI and all supported languages.

These changes collectively improve the user experience when working with file content in Roo, making the behavior more intuitive and the UI more informative, especially when dealing with large files or specific line ranges.

Test Procedure

Testing was performed by:

  1. Verifying tooltips display correctly with proper variable substitution in all supported languages
  2. Testing file reading with various configurations:
    • Large files that trigger auto-truncation
    • Files with explicit line range requests (start_line/end_line)
    • Files with different maxReadFileLine settings (0, positive values, -1 for full read)
  3. Confirming line range notifications appear correctly in all scenarios
  4. Running the translation verification script (node scripts/find-missing-translations.js) to ensure all translations are complete
  5. Manual testing in different language settings to verify correct text display

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • ♻️ Refactor Changes
  • 💅 Cosmetic Changes
  • 📚 Documentation update
  • 🏃 Workflow Changes

Pre-flight Checklist

  • Changes are limited to a single feature, bugfix or chore (split larger changes into separate PRs)
  • Tests are passing (npm test) and code is formatted and linted (npm run format && npm run lint)
  • I have created a changeset using npm run changeset (required for user-facing changes)
  • I have reviewed contributor guidelines

Screenshots

BEFORE:
Screenshot 2025-05-15 at 19 21 17

AFTER:
Screenshot 2025-05-15 at 19 22 23

Additional Notes

This PR highlights the importance of maintaining consistent translation namespaces across both the extension and webview components. For future development, we should consider adding an automated check to ensure translation namespaces remain synchronized between the two components to prevent similar issues.

The improvements to line range notifications and truncation handling make the file reading experience more intuitive and consistent for users, especially when working with large files or specific line ranges.


Important

Enhance file read UX with tooltips, consistent line range notifications, and updated translations.

  • Behavior:
    • Added tooltips to truncation messages in ChatRow.tsx to guide users on adjusting file read settings.
    • Improved wasAutoTruncated flag logic in readFileTool() in readFileTool.ts to ensure correct UI behavior.
    • Modified readFileTool() to always display line range notifications.
    • Hidden truncation messages for explicit line range reads in readFileTool.ts.
  • Translations:
    • Added tools.json for all supported languages in webview-ui/src/i18n/locales/ to support new tooltips and messages.
  • Misc:
    • Updated ClineSayTool in ExtensionMessage.ts to include wasAutoTruncated property.

This description was created by Ellipsis for b93412b65587a71bfa4995e7b405f37aa91d7d1f. You can customize this summary. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented May 15, 2025

⚠️ No Changeset found

Latest commit: b93412b65587a71bfa4995e7b405f37aa91d7d1f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. bug Something isn't working enhancement New feature or request labels May 15, 2025
@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap May 16, 2025
@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap May 20, 2025
@hannesrudolph hannesrudolph moved this from PR [Needs Review] to TEMP in Roo Code Roadmap May 26, 2025
@daniel-lxs daniel-lxs moved this from TEMP to PR [Needs Review] in Roo Code Roadmap May 27, 2025
@hannesrudolph hannesrudolph added Followup Needs followup from support or code team and removed Followup Needs followup from support or code team labels May 27, 2025
@daniel-lxs
Copy link
Member

Hey @cannuri, It seems like something happened when you generated the roo-code.d.ts causing it to remove a lot of types, this should be easy to fix by simply regenerating the file.

Other than that this looks good to me.

@daniel-lxs daniel-lxs moved this from PR [Needs Preliminary Review] to PR [Needs Review] in Roo Code Roadmap May 27, 2025
@daniel-lxs daniel-lxs added PR - Changes Requested and removed Followup Needs followup from support or code team PR - Needs Review labels May 27, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Review] to PR [Changes Requested] in Roo Code Roadmap May 28, 2025
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels May 30, 2025
@cannuri
Copy link
Contributor Author

cannuri commented May 30, 2025

Hey @cannuri, It seems like something happened when you generated the roo-code.d.ts causing it to remove a lot of types, this should be easy to fix by simply regenerating the file.

Other than that this looks good to me.

oops... ok done

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Jun 2, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @cannuri, Thank you for fixing the issue with the types file.

I left another suggestion to hopefully have this reviewed soon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I understand that the translation autoTruncateTooltip is now necessary on the webview, it seems like it's the only translation currently used from this file, we might want to clean this up and only leave the used translation.

If leaving a locale file with a single translation key is undesirable then it might be a good idea to move it to chat.json.

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 4, 2025
@daniel-lxs daniel-lxs requested a review from jr as a code owner June 12, 2025 21:19
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jun 12, 2025
@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Draft / In Progress] in Roo Code Roadmap Jun 12, 2025
@daniel-lxs daniel-lxs marked this pull request as draft June 12, 2025 21:22
@hannesrudolph
Copy link
Collaborator

stale

@github-project-automation github-project-automation bot moved this from PR [Pre Approval Review] to Done in Roo Code Roadmap Jul 7, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request PR - Draft / In Progress size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Improve UX for file read truncation message

3 participants