Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sst/opencode
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dev
Choose a base ref
...
head repository: micuintus/opencode
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: dev
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 3 commits
  • 6 files changed
  • 1 contributor

Commits on Dec 9, 2025

  1. feat: restrict formatting only to the edited line range for clang-format

    When using the Edit tool, clang-format now only formats the specific lines
    that were changed, rather than reformatting the entire file. This prevents
    unrelated formatting changes from cluttering the diff.
    
    Adds calculateChangedLines() to detect modified line ranges from diffs,
    and updates clang-format to use --lines flag for targeted formatting.
    Other formatters continue to format the entire file as before.
    
    Closes #4603
    Michael Voigt committed Dec 9, 2025
    Configuration menu
    Copy the full SHA
    43c1d51 View commit details
    Browse the repository at this point in the history
  2. refactor(format): enhance range-based formatting implementation

    Switch from line-based to exact character/byte range formatting with a
    robust DiffRange class. This refactoring improves compatibility across
    different formatters and adds comprehensive validation.
    
    Changes:
    - Replace line ranges with exact character and byte offset tracking
    - Implement DiffRange class to encapsulate range logic and conversions
    - Add support for Prettier (character offsets) and clang-format (byte offsets)
    - Handle Unicode multi-byte characters correctly
    - Merge adjacent ranges to reduce formatter invocations
    - Add validation to fromJSON() for negative/invalid ranges
    - Extract clampOffset() helper to reduce code duplication
    - Remove unused toByteOffsets() method
    - Cache Buffer.byteLength() calls to avoid redundant computation
    - Fix duplicate getCachedByteOffsets() calls in merge()
    
    Ref #4603
    Michael Voigt committed Dec 9, 2025
    Configuration menu
    Copy the full SHA
    1c0676f View commit details
    Browse the repository at this point in the history
  3. refactor(format): Follow style guide in new subfile autoformatting fe…

    …ature
    
    - calculateChangedRanges -> calculateRanges
    - Simplify variable names (charOffset etc.)
    - Replace else statements with early returns
    - mergeAdjacentRanges -> mergeRanges
    
    Style guide: https://github.com/sst/opencode/blob/dev/STYLE_GUIDE.md
    
    Ref #4603
    Michael Voigt committed Dec 9, 2025
    Configuration menu
    Copy the full SHA
    269b606 View commit details
    Browse the repository at this point in the history
Loading