Color *_test.go files the same way *.test.ts are colored#311700
Color *_test.go files the same way *.test.ts are colored#311700jakebailey wants to merge 1 commit intomicrosoft:mainfrom
*_test.go files the same way *.test.ts are colored#311700Conversation
| // 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
getIconClassesto 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.gofiles 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. |
54a1242 to
c333146
Compare
|
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:
|
|
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. |
For JS/TS, test files are shown in another color:
I'd love to have this for Go, where it's hard to visually find test files:
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:There are other languages that use a
*_test.<ext>convention or similar, including:test_*.pyis also listed, which I have not handled)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!)