Skip to content

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

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

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