Skip to content

Edit Tool Not Applying Whitespace-Only Changes #20876

Closed as not planned
Closed as not planned

Description

@lsteveol

Description

Description

The Edit tool appears to not apply changes when the modification is primarily whitespace (indentation changes from 4 spaces to 2 spaces, or alignment of colons/equals signs).

Reproduction Steps

  1. Open a file with 4-space indentation
  2. Use the Edit tool to change indentation to 2 spaces
  3. Tool reports "Edit applied successfully"
  4. Check the file - indentation is still 4 spaces

Example

Original content:

class DataModel:
    name: str = Field(...)
    value: int = Field(...)
    count: int = Field(...)

Expected after edit:

class DataModel:
  name: str = Field(...)
  value: int = Field(...)
  count: int = Field(...)

Actual result: File remains unchanged (still 4-space indentation)

Workaround

Using sed command works:

sed -i 's/^    /  /g' file.py

Or using bash heredoc with cat > file << 'EOF' also works.

Additional Observations

  • Edit tool does work when there are non-whitespace changes (e.g., adding comments)
  • Tool reports success even when changes aren't applied
  • Write tool also appears to have the same issue

Potential Causes

  1. Edit tool may be normalizing whitespace before/after comparison
  2. File system or editor may be auto-formatting after write
  3. Tool may require a non-whitespace diff to trigger actual file write

Impact

Blocks ability to format code consistently with project style guidelines (2-space indentation with aligned colons).

Plugins

No response

OpenCode version

1.3.13

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Ubuntu 22.04

Terminal

No response

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 3, 2026
  2. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  3. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions