



Smarter Razor syntax completions, such as completion and auto complete are now supported. The new Razor editor supports the latest compiler features and polishes existing syntax interactions. The new editor provides improved formatting that is better able to keep up with these changes helping code stay visually consistent. This highlight made selections difficult to distinguish and added visual clutter for many developers.įormatting is an active area as more code styles, refactoring, and completion capabilities are added regularly. A major difference in this area is the removal of the code background highlight that was present in previous versions. This support would not have been possible without the new R azor editor’s LSP model.ĭefault colors have been updated in the new Razor editor. There is also more navigation support. One of the most used navigation features throughout Visual Studio is Go to Definition. Go to Definition on components helps you quickly navigate throughout files to better understand your code. For example, pressing F12 on a component tag will now navigate you right to the component code.Ī cutting-edge feature like Hot Reload i s best when the F5 experience has useful diagnostics. Many more are planned in the future as Razor evolves. For example, E xtract block to code behind allows you to extract an entire code block to a code behind file if you prefer the code behind pattern.Īdditional new Razor refactorings include: Add usings for component, Fully qualify component, and Create component. These are crucial for picking up the everyday syntax and common elements of R azor. There are also a few refactorings added that are specific to Razor development. The most used refactoring, Add missing usings is now supported in the R azor editor as well as many more! The new model opens the doors to add new code fixes and refactorings more easily. What’s available in the new Razor editor? The LSP model has enabled us to add significant new functionality, bringing many more of the C# editing features to Razor and enabling other new Razor specific productivity improvements at an accelerated pace. The Language Server Protocol (LSP), is an open-source protocol that defines a standard way for an editor or IDE to enable features.

We have been working for some time on a new Razor editor for ASP.NET Core projects based on a Language Server Protocol (LSP). Benefits of moving to a Razor Language Server Protocol With the release of Visual Studio 2022 you can now use the new Razor editor for local ASP.NET Core development with MVC, Razor Pages, and Blazor.ĭownload Visual Studio 2022 and make sure to update to 17.0.2 to get the latest Razor updates.
