Skip to content

Color *_test.go files the same way *.test.ts are colored#311700

Open
jakebailey wants to merge 1 commit intomicrosoft:mainfrom
jakebailey:underscore-test-colors
Open

Color *_test.go files the same way *.test.ts are colored#311700
jakebailey wants to merge 1 commit intomicrosoft:mainfrom
jakebailey:underscore-test-colors

Conversation

@jakebailey
Copy link
Copy Markdown
Member

For JS/TS, test files are shown in another color:

image

I'd love to have this for Go, where it's hard to visually find test files:

image

But, this didn't end up working out of the box as the highlighting system only looks for dot separated strings.

Adding _ separation enables this:

image

There are other languages that use a *_test.<ext> convention or similar, including:

Which could benefit from a change like this, though I don't know what color to give those (TS vs Go is easy because they're both blue, so orange seems fine!)

Copilot AI review requested due to automatic review settings April 21, 2026 15:36
Comment on lines +73 to +74
// Handle underscore-suffixed base names (e.g., foo_test.go → _test.go)
// to enable icon themes to target naming conventions like Go's _test.go files
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only handles suffixes; this whole suffixing method does not work for something like test_*.py where I don't even know what would go into the icon theme.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the file-icon class generation so icon themes can target underscore-suffixed filename conventions (e.g. Go’s *_test.go) similarly to existing dot-based compound extensions (e.g. *.test.ts).

Changes:

  • Extend getIconClasses to emit an additional “underscore-suffix + extension” class (e.g. _test.go-ext-file-icon) when applicable.
  • Add a focused unit test suite validating dot-based and underscore-suffix class generation behavior.
  • Update the Seti icon theme to color Go _test.go files distinctly, and clarify the JSON schema description.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/services/themes/common/fileIconThemeSchema.ts Updates schema description to document dot-compound and underscore-suffix extension support.
src/vs/editor/common/services/getIconClasses.ts Adds underscore-suffix compound extension class generation alongside existing dot-compound extension classes.
src/vs/editor/test/common/services/getIconClasses.test.ts Adds new unit tests covering the new underscore-suffix behavior and related edge cases.
extensions/theme-seti/icons/vs-seti-icon-theme.json Introduces Seti mappings/definitions to apply a distinct color to _test.go files in dark/light themes.

Comment thread src/vs/editor/test/common/services/getIconClasses.test.ts Outdated
Comment thread src/vs/editor/test/common/services/getIconClasses.test.ts Outdated
@benvillalobos
Copy link
Copy Markdown
Member

benvillalobos commented Apr 24, 2026

LGTM but I think this has implications for other languages as well. Assigning @aeschli (area owner) to review

What an agent brought up for me:

Every file with underscores gets additional CSS classes on its DOM element. In a large repo with thousands of snake_case files, that's non-trivial class list bloat. It's probably negligible in practice, but worth the team being aware of.

It's a new public contract for icon theme authors. Any third-party theme could start defining _spec.rb, _test.py, etc. This is presumably the intent, but it's a feature surface area expansion that should be a deliberate decision.

@jakebailey
Copy link
Copy Markdown
Member Author

Yeah, probably worth asking some designers or Go people; I can understand why some might be surprised by this. It turned out that only TS/JS do this in VS Code today.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants