diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cd277d9a..4afd34433 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,125 @@ - Debug from .csproj and .sln [#5876](https://github.com/dotnet/vscode-csharp/issues/5876) # 2.140.x -* See 2.136.x for full list of changes. + +This update brings new language features like Type Hierarchy and Call Hierarchy, major file-based apps improvements, significant performance gains, extensive Razor formatting and editing enhancements, Blazor WebAssembly debugging, and MAUI tooling improvements. + +## C# Language Support + +### Selection Range + +The LSP now supports **Selection Range** (`Expand Selection` / `Shrink Selection`), enabling smart expanding and shrinking of text selections based on the syntactic structure of your C# code. For example, you can progressively select from a variable name → the containing statement → the containing block → the method → the class, all with keyboard shortcuts. ([roslyn#82809](https://github.com/dotnet/roslyn/pull/82809)) + +### Type Hierarchy and Call Hierarchy + +Two powerful navigation features are now available for C# in VS Code: + +- **Type Hierarchy** lets you explore the full inheritance chain of any class, interface, or struct — navigate through base types and derived types without leaving the editor. ([roslyn#83011](https://github.com/dotnet/roslyn/pull/83011)) +- **Call Hierarchy** lets you trace incoming and outgoing calls for any method, making it easy to understand how your code connects. Interface implementation categories for overrides are correctly shown, so you get an accurate picture of the full call chain. ([roslyn#82865](https://github.com/dotnet/roslyn/pull/82865)) + +### File-based apps: automatic discovery and improved editing + +C# file-based apps (standalone `.cs` files that run without a project file) can now be [automatically discovered](https://github.com/dotnet/roslyn/blob/main/docs/features/file-based-programs-vscode.md#automatic-discovery) in the opened workspace folders. Set `dotnet.fileBasedApps.enableAutomaticDiscovery` to `true` to use it. This is particularly recommended when using the new `#:include` directive to enable file-based apps made up of multiple `.cs` files. + +Beyond discovery, the editing experience for file-based apps has been refined: + +- **Transitive `#:` directives** are now handled correctly, so transitive dependencies resolve properly. +- **`#:` directives are preserved during formatting**, preventing the formatter from mangling file-based app metadata. +- **Completions for `#:include` directives** help you discover available files as you type. +- **Improved colorization** of file-based app directives makes them visually distinct from regular C# code. + +([vscode-csharp#9096](https://github.com/dotnet/vscode-csharp/pull/9096)) + +## Performance + +### Faster solution loading with parallel analyzer initialization + +Solution-level analyzers now load in parallel during project initialization. In solutions with many analyzers (which is common when using .NET Analyzers, StyleCop, or other code analysis packages), this can meaningfully reduce the time between opening a solution and seeing your first diagnostics. ([roslyn#82447](https://github.com/dotnet/roslyn/pull/82447)) + +### Reduced memory allocations across the language server + +A broad sweep of allocation reductions has been made across many hot paths in the language server: + +- **Syntax trivia handling** — modified search and walk methods now check green nodes first, avoiding unnecessary allocations. +- **Text diffing and source text operations** — internal text line data structures now pack data more efficiently, reducing per-line overhead. +- **Completion** — repeated `int.ToString` calls during completion item generation are now avoided. +- **Document analysis and code fix service** — result creation and predicate evaluation now reuse objects instead of allocating. + +These improvements contribute to lower GC pressure and smoother editing, especially in large codebases. + +## Razor + +### Unused directives: fade, remove, and sort + +Unused `@using` directives in Razor files now appear **faded**, just like unused `using` statements in C# files. A new **"Remove unnecessary usings"** code action lets you clean them up in one click. + +Additionally, two new commands are available for Razor files: + +- **Remove and Sort Usings** — removes unused directives and sorts the remainder. +- **Sort and Consolidate Usings** — sorts and consolidates `@using` directives without removing any. + +These features bring Razor's `@using` management in line with the C# editing experience. ([vscode-csharp#9040](https://github.com/dotnet/vscode-csharp/pull/9040)) + +### Generate Method code action + +The **Generate Method** code action now works in Razor files. When you call a method that doesn't exist yet, you can generate a stub directly from the Razor editor — no need to switch to a `.cs` file first. This also works from the C# editor for methods referenced in Razor documents. ([vscode-csharp#9162](https://github.com/dotnet/vscode-csharp/pull/9162)) + +### Rename in Razor source-generated documents + +Rename operations now work correctly in Razor source-generated documents, enabling more seamless refactoring across Razor and C# boundaries. Previously, renames could fail when the source-generated document couldn't be mapped back. ([vscode-csharp#9155](https://github.com/dotnet/vscode-csharp/pull/9155)) + +### Formatting fixes + +A large number of Razor formatting issues have been resolved in this release: + +- **Multiline `@if` statements** are now formatted correctly. +- **Ternary expressions** inside Razor blocks no longer break formatting. +- **Wrapped CSS** in Razor files is now indented properly. +- **`
` tags** are now treated like `