Skip to content

Conversation

@nisedo
Copy link

@nisedo nisedo commented Dec 10, 2025

Summary

  • Allow Revert Tree String to Text command to revert only the selected text when a selection exists
  • Preserve the original behavior of reverting the entire file when no text is selected

Motivation

Previously, the "Revert Tree String to Text" command would always revert the entire document, regardless of whether text was selected. This made it impossible to selectively revert portions of a tree file.

With this change, users can now:

  1. Select specific tree sections and revert only those portions
  2. Use the command without selection to revert the entire file (original behavior preserved)

Changes

  • Modified extension.asciiTreeGeneratorRevertToText command in src/extension.ts to check for active selection
  • Updated CHANGELOG.md with the change under [Unreleased]

Test plan

  • All existing tests pass (yarn test)
  • Linter passes (yarn lint)
  • Code is properly formatted (yarn prettify)
  • Manual testing:
    • Open a .tree file with formatted tree content
    • Select a portion of the tree and run "Revert Tree String to Text" → only selected text should be reverted
    • Run "Revert Tree String to Text" without selection → entire file should be reverted

Previously, the "Revert Tree String to Text" command would always revert
the entire document. This change makes the command revert only the
selected text when a selection exists, while preserving the original
behavior of reverting the entire file when no text is selected.
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