Add file-nesting patterns for C# development files#2215
Closed
Conversation
Copilot
AI
changed the title
[WIP] Contribute a set of default file-nesting patterns via the extension
Add file-nesting patterns for C# development files
Aug 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements the requested file-nesting patterns to improve file organization in the VS Code Explorer for C# development projects.
What this adds
The extension now contributes default file-nesting patterns via
configurationDefaultsinpackage.jsonthat automatically organize related files under their parent files when file nesting is enabled in VS Code.File-nesting patterns included
C# source files (
*.cs) - nests generated and designer files:Program.designer.cs→ nested underProgram.csProgram.g.cs→ nested underProgram.csProgram.generated.cs→ nested underProgram.csProject files (
*.csproj) - nests user-specific settings:MyProject.csproj.user→ nested underMyProject.csprojConfiguration files (
*.json) - nests environment-specific configs:appsettings.Development.json→ nested underappsettings.jsonRazor pages (
*.cshtml) - nests code-behind and styles:Index.cshtml.cs→ nested underIndex.cshtmlIndex.cshtml.css→ nested underIndex.cshtmlBlazor components (
*.razor) - nests code-behind and styles:Counter.razor.cs→ nested underCounter.razorCounter.razor.css→ nested underCounter.razorXAML files (
*.xaml) - nests code-behind:MainWindow.xaml.cs→ nested underMainWindow.xamlHow it works
The patterns use VS Code's built-in file nesting feature with the
${capture}token to match the base filename. When a user hasexplorer.fileNesting.enabled: truein their settings, these patterns will automatically organize their C# project files for a cleaner Explorer view.Implementation details
configurationDefaultssection topackage.jsonwith the exact patterns requestedFixes #1823.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.