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

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube