From b703c76d09b8deeac51b7f632e6179f3832ec9fa Mon Sep 17 00:00:00 2001 From: Mads Kristensen Date: Mon, 12 Jan 2026 10:30:32 -0800 Subject: [PATCH] Update instructions with .editorconfig and .NET constraints Added guidelines for adhering to .editorconfig and .NET Framework constraints. --- instructions/vsixtoolkit.instructions.md | 45 ++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/instructions/vsixtoolkit.instructions.md b/instructions/vsixtoolkit.instructions.md index 4db23c02..c445b242 100644 --- a/instructions/vsixtoolkit.instructions.md +++ b/instructions/vsixtoolkit.instructions.md @@ -23,6 +23,47 @@ Verify the project uses the toolkit by checking for: - Ensure all UI respects Visual Studio themes - Follow VSSDK and VSTHRD analyzer rules - Produce testable, maintainable extension code +- **Adhere to `.editorconfig` settings** when present in the repository + +## Code Style (.editorconfig) + +**If an `.editorconfig` file exists in the repository, all generated and modified code MUST follow its rules.** + +This includes but is not limited to: +- Indentation style (tabs vs spaces) and size +- Line endings and final newline requirements +- Naming conventions (fields, properties, methods, etc.) +- Code style preferences (`var` usage, expression bodies, braces, etc.) +- Analyzer severity levels and suppressions + +Before generating code, check for `.editorconfig` in the repository root and apply its settings. When in doubt, match the style of surrounding code in the file being edited. + +## .NET Framework and C# Language Constraints + +**Visual Studio extensions target .NET Framework 4.8** but can use modern C# syntax (up to C# 14) with constraints imposed by the .NET Framework runtime. + +### ✅ Supported Modern C# Features +- Primary constructors +- File-scoped namespaces +- Global usings +- Pattern matching (all forms) +- Records (with limitations) +- `init` accessors +- Target-typed `new` +- Nullable reference types (annotations only) +- Raw string literals +- Collection expressions + +### ❌ Not Supported (.NET Framework Limitations) +- `Span`, `ReadOnlySpan`, `Memory` (no runtime support) +- `IAsyncEnumerable` (without polyfill packages) +- Default interface implementations +- `Index` and `Range` types (no runtime support for `^` and `..` operators) +- `init`-only setters on structs (runtime limitation) +- Some `System.Text.Json` features + +### Best Practice +When writing code, prefer APIs available in .NET Framework 4.8. If a modern API is needed, check if a polyfill NuGet package exists (e.g., `Microsoft.Bcl.AsyncInterfaces` for `IAsyncEnumerable`). ## Example Prompt Behaviors @@ -269,7 +310,7 @@ The toolkit provides automatic theming for WPF UserControls: For dialog windows, use `DialogWindow`: ```xml -