Skip to content

[Feature]: Honor .editorconfig tab width and optionally render whitespace in file and diff views #11076

Closed

Description

@AndreiShenets

Problem

Projects that use tab characters can be difficult to read in T3 Code because tabs are currently always rendered at a fixed width of two spaces.

If a project's .editorconfig defines a different tab width, code that is correctly aligned in other editors appears compressed or misaligned in T3 Code. Deeply nested code becomes difficult to scan, and alignment based on tab stops can appear broken.

This affects both file and diff views. It is also difficult to distinguish tabs from spaces when reviewing formatting-sensitive changes.

Proposed solution

Have T3 Code's file and diff views honor the applicable .editorconfig settings for each file:

  • Use tab_width when specified.
  • Fall back to indent_size when tab_width is not specified.
  • Resolve the nearest applicable .editorconfig section based on the file path.

This should only affect how existing tab characters are displayed. It should not rewrite files or convert tabs to spaces.

Additionally, add a Show whitespace characters setting for file and diff views:

  • When disabled, whitespace is rendered normally.
  • When enabled, spaces are shown with dot markers and tabs with arrow markers.
  • The setting applies consistently to both file and diff views.
  • The setting is disabled by default.

Expected behavior

Given this .editorconfig:

root = true

[*]
indent_style = tab
indent_size = 4
tab_width = 4

[*.md]
indent_style = space
indent_size = 2

Tab characters in source files should occupy four columns in file and diff views.

When Show whitespace characters is enabled, spaces and tabs should have distinct visible markers so indentation and whitespace-only changes can be reviewed accurately.

Activity

  1. juliusmarminge commented on Sep 10, 2026

    @juliusmarminge
    Member

    Thanks for the clear write-up — this checks out.

    What’s going on

    File and diff views (file preview, working-tree/checkpoint diffs, and PR code review) all render through @pierre/diffs. That library’s documented default is --diffs-tab-size: 2, and T3 Code never overrides it. There is also no .editorconfig lookup today, so a project with tab_width = 4 / indent_size = 4 will look compressed or misaligned here even when other editors are correct.

    This is display-only. Nothing in the current path rewrites files or converts tabs to spaces.

    Not the same as existing whitespace settings

    • Hide whitespace changes (diffIgnoreWhitespace) ignores whitespace-only diff hunks. It does not change how a tab is drawn.
    • Word wrap only controls wrapping.
    • PR #10459 is about preserving trailing whitespace in parsed patches, not tab stops or visible markers.

    No duplicate of this feature request turned up.

    Suggested implementation (web/desktop first)

    1. Resolve the nearest applicable .editorconfig section for the open file (tab_width, else indent_size) via existing projects.readFile, and cache it per workspace.
    2. Pass that value through as --diffs-tab-size on the shared Pierre surfaces (FilePreviewPanel, StyledDiffCodeView / AnnotatableCodeView, PR code tab).
    3. Add a default-off Show whitespace characters client setting (spaces → dots, tabs → arrows) that applies to both file and diff views.

    Mobile native review diffs do not use Pierre’s CSS tab-size, so they can be a follow-up.

    Happy to take a PR that stays display-only and covers file + diff together.

  2. AndreiShenets commented on Oct 8, 2026

    @AndreiShenets
    ContributorAuthor

    Hi @juliusmarminge PR is attached. Please review when you have time.

  3. locked and limited conversation to collaborators on Oct 11, 2026
  4. converted this issue into a discussion #17978 on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequested improvement or new capability.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions