Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Improvements to the new Razor editor in Visual Studio

#1
Improvements to the new Razor editor in Visual Studio

Daniel Roth

Daniel

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. 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. We hope you’ll give the new Razor editor a try and share feedback with us on your experience!

Get started


To get started wtih the new Razor editor:

  1. Install the latest Visual Studio preview (16.9 Preview 3).

    • Note: Visual Studio previews can be safely installed side-by-side with your stable Visual Studio installation.
  2. Go to Tools > Options > Environment > Preview Features and select the Enable experimental Razor editor option:

    Enable new experimental Razor editor

When you go to turn on the new Razor editor you may find that it’s already on. Starting with Visual Studio 16.9 Preview 3 we are slowly rolling out the new Razor editor to different groups of users. If you tried out the new editor previously and then turned it off, you won’t be part of the automatic rollout. You’ll need to manually reenable it to see all the progress that we’ve made. Many of the known issues with the new editor have now been fixed, so it’s worth giving it another shot if you hit blocking issues with earlier builds.

What’s new?


In addition to working on the basics of the Razor editor experience (completions, diagnostics, tooltips, syntax coloring, etc.) the team has added a bunch of new features to the new Razor editor. Many of these features were made possible or simpler to implement by the new Language Server Protocol (LSP) based architecture.

Improved formatting


The new Razor editor has an improved formatting engine that is more conservative than the old one (first, do no harm!), and is also much smarter about how it handles your code.

Formatting Counter

We’re committed to fixing Razor formatting so that it makes you smile with the new editor, so let us know if you hit formatting issues and we’ll be sure to get them addressed.

C# code actions


Some C# code actions are now available in Razor files:

  • Add @using directives or fully qualified type names.

    Add @using from C#

  • Add null checks.

    Add null checks

The design of the new Razor editor makes it much easier to enable C# code actions, and we expect to enable many more in future releases.

Rename across closed files


Renaming is no longer limited to open Razor files. Names in closed Razor files will get updated as well.

Rename across closed Razor files

Rename Blazor components


You can now rename a Blazor component from it’s tag. The component Razor file will get renamed automatically.

Rename component

Component code actions


Several component specific code actions are also now available:

  • Create component from unknown tag.

    Create component from unknown tag

  • Extract @code to code-behind.

    Extract @code to code-behind

  • Add @using for components or fully qualified component tag.

    Add using for component

Go to component definition


Need to see the code for that component fast? Just hit F12 on the tag and you’re there!

Go to component definition

Edit Razor with LiveShare


The new Razor editor also works with LiveShare, so you’ll get all of the new Razor editing goodness even when working with Razor over a remote session.

Use the new Razor editor with Visual Studio Code


Because the new Razor editor is based on a reusable Razor language server, the new Razor editor and its new features are also available from Visual Studio Code with the C# extension installed.

What about Visual Studio for Mac? Visual Studio for Mac doesn’t have LSP support just yet, but once it does we’ll bring the new Razor editor to Visual Studio for Mac as well.

Razor syntax coloring improvements


We’re also working on some improvements to Razor syntax coloring in the new editor that we’d love to get your feedback on. Please take a moment to share with us your opinions by taking the following surveys if you haven’t already:

Known issues


There are still some known issues with this release of the new Razor editor:

  • 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.

These issues are all being worked on and will be addressed in future releases.

Giving feedback


If you hit an issue with the new editor, the best way to let us know is using the Send Feedback > Report a Problem feature in Visual Studio.

Report a problem

In addition to the information you provide, the submitted issue will automatically include all of the relevant logs needed for us to diagnose and address the issue.

We hope you enjoy trying out the new Razor editor. Thanks for giving the new Razor editor and for sharing your feedback with us!



https://www.sickgaming.net/blog/2021/01/...al-studio/
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Generating HTTP API clients using Visual Studio Connected Services xSicKxBot 0 16 02-24-2021, 05:07 PM
Last Post: xSicKxBot
  gRPC performance improvements in .NET 5 xSicKxBot 0 101 10-28-2020, 04:40 PM
Last Post: xSicKxBot
  New experimental Razor editor for Visual Studio xSicKxBot 0 162 09-10-2020, 08:51 AM
Last Post: xSicKxBot
  New experimental Razor editor for Visual Studio xSicKxBot 0 201 07-17-2020, 07:41 AM
Last Post: xSicKxBot
  Configuring Azure Services and emulators using Visual Studio xSicKxBot 0 202 06-04-2020, 12:16 PM
Last Post: xSicKxBot
  Configuring Azure Services and emulators using Visual Studio xSicKxBot 0 238 05-08-2020, 02:41 AM
Last Post: xSicKxBot
  Improvements in .NET Core 3.0 for troubleshooting and monitoring distributed apps xSicKxBot 0 517 11-17-2019, 06:35 PM
Last Post: xSicKxBot
  Updated Razor support in Visual Studio Code, now with Blazor support xSicKxBot 0 410 07-23-2019, 02:08 PM
Last Post: xSicKxBot
  Updated Razor support in Visual Studio Code, now with Blazor support xSicKxBot 0 514 04-30-2019, 12:17 AM
Last Post: xSicKxBot
  Web and Azure Tool Updates in Visual Studio 2019 xSicKxBot 0 595 04-05-2019, 11:03 PM
Last Post: xSicKxBot

Forum Jump:

[-]
Active Threads
[Tut] Python memoryview() — Tame That St...
Last Post: xSicKxBot
Today 09:36 AM
» Replies: 0
» Views: 1
(Indie Deal) Imperator Rome, Surviving M...
Last Post: xSicKxBot
Today 09:36 AM
» Replies: 0
» Views: 1
DaVinci Resolve 17 Released
Last Post: xSicKxBot
Today 09:36 AM
» Replies: 0
» Views: 2
AppleInsider - Apple says Developer Tran...
Last Post: xSicKxBot
Today 09:36 AM
» Replies: 0
» Views: 1
Microsoft - People of Microsoft: Corneli...
Last Post: xSicKxBot
Today 09:36 AM
» Replies: 0
» Views: 1
News - Superman Reboot Movie Is Coming F...
Last Post: xSicKxBot
Today 09:35 AM
» Replies: 0
» Views: 3
Hot to get Unbanned From Origin (Battlef...
Last Post: trioxyn
Today 05:04 AM
» Replies: 1
» Views: 1677
Battlefield 4 Hack / Mod (MultiHack Tool...
Last Post: trioxyn
Today 04:57 AM
» Replies: 9
» Views: 11372
News - Destiny 2021 Update: The Road to ...
Last Post: xSicKxBot
Today 03:03 AM
» Replies: 0
» Views: 2
News - Hot Wheels Unleashed Speeds Onto ...
Last Post: xSicKxBot
Today 03:02 AM
» Replies: 0
» Views: 2

[-]
Twitter

[-]
Sponsored
Get the Deal of the Week at RefurBees.com

Copyright © SickGaming.net 2012-2020