News

New Visual Studio Razor Editor 'Close to Being Ready' for Blazor and Other Projects

The experimental Razor editor for Visual Studio introduced last summer has been updated and is "close to being ready for normal daily development."

Microsoft last July announced the experimental Razor editor for use in projects to develop applications for MVC, Razor Pages and Blazor, the latter being an ASP.NET Core component that allows for web development in C# instead of JavaScript.

Daniel Roth, principal program manager for ASP.NET, described Razor like this when the editor was announced: "Razor is a templating language based on HTML and C# used to define dynamic rendering logic for .NET web apps.... In MVC and Razor Pages apps you use Razor to define the rendering logic for your views and pages using .cshtml files. In Blazor, you use Razor to author reusable UI components in .razor files. Razor is a critical part of the experience for building web apps with .NET."

Razor Editor Architecture
[Click on image for larger view.] Razor Editor Architecture (source: Microsoft).

This week, he penned a new post to provide updates on the editor's progress, which included bolstering basic functionality like code completions and diagnostics and new features, some of which include:

  • Better formatting: An improved formatting engine, more conservative than the old one and reportedly much smarter about how it handles code
  • C# code actions: Now available are "Add @using directives for fully qualified type names" and "Add null checks," with many more to be enabled as the editor's new design makes it easier to do solution
  • Renaming: This is no longer limited to open Razor files, as closed Razor files will get updated as well, and developers can now rename a Blazor component from its tag, and the component Razor file will get renamed automatically
  • LiveShare support: The editor works over a remote session
  • VS Code option: The editor, being based on a reusable Razor language server that provides specific language "smartness," can be used in Visual Studio Code with the C# extension installed

Since the July debut, meanwhile, the list of "known issues" has decreased greatly, with the remaining ones including:

  • Razor syntax coloring imperfections. Razor syntax coloring may sometimes require an edit to trigger, or in some cases may use incorrect colors.
  • No snippet completions. Snippet completions (like prop) aren’t yet supported with the new editor.
  • Limited override completion. Method override completions will only generate the method name, and not the full method signature.
Enabling the Razor Editor
[Click on image for larger view.] Enabling the Razor Editor (source: Microsoft).

Roth is soliciting developer feedback on the editor via the "Send Feedback > Report a Problem" feature in Visual Studio, and he also pointed to surveys being held to gather feedback on syntax coloring, one here and one here.

"It's been six months since we announced the first preview of a new experimental Razor editor for Visual Studio based on a common Razor language server and it's time to give an update on our progress," he said. "The team has been hard at work bringing the new Razor editor up to parity with the old one, fixing bugs, and adding lots of great new functionality. We think the new editor is close to being ready for normal daily development, so now is the time to give it a try with the latest Visual Studio preview."

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Mastering Blazor Authentication and Authorization

    At the Visual Studio Live! @ Microsoft HQ developer conference set for August, Rockford Lhotka will explain the ins and outs of authentication across Blazor Server, WebAssembly, and .NET MAUI Hybrid apps, and show how to use identity and claims to customize application behavior through fine-grained authorization.

  • Linear Support Vector Regression from Scratch Using C# with Evolutionary Training

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the linear support vector regression (linear SVR) technique, where the goal is to predict a single numeric value. A linear SVR model uses an unusual error/loss function and cannot be trained using standard simple techniques, and so evolutionary optimization training is used.

  • Low-Code Report Says AI Will Enhance, Not Replace DIY Dev Tools

    Along with replacing software developers and possibly killing humanity, advanced AI is seen by many as a death knell for the do-it-yourself, low-code/no-code tooling industry, but a new report belies that notion.

  • Vibe Coding with Latest Visual Studio Preview

    Microsoft's latest Visual Studio preview facilitates "vibe coding," where developers mainly use GitHub Copilot AI to do all the programming in accordance with spoken or typed instructions.

  • Steve Sanderson Previews AI App Dev: Small Models, Agents and a Blazor Voice Assistant

    Blazor creator Steve Sanderson presented a keynote at the recent NDC London 2025 conference where he previewed the future of .NET application development with smaller AI models and autonomous agents, along with showcasing a new Blazor voice assistant project demonstrating cutting-edge functionality.

Subscribe on YouTube