razor: Visual Studio 2022 Preview 4.1 -- Blazor Code Snippets inside Razor file not working

This issue has been moved from a ticket on Developer Community.


[severity:It bothers me. A fix would be nice] Steps to reproduce:

  • Open Visual Studio Preview 4.1
  • Create a new Blazor WebAssembly project using the default template
  • Open the Counter.razor page
  • In the markup section (not the code section), type @if followed by pressing <kbd>Tab</kbd> twice on the keyboard to insert an IF block. <Nothing happens>

You can compare this to following the same steps in Visual Studio 2019, where the snippet is inserted. I should note that VS2019 does seem to mess up the spacing and indenting. And normally true would get inserted as the default for the condition which goes not happen even in 2019, but reporting based on 2022 being less functional than 2019.

I’m attaching a video of the difference between VS2019 and VS2022.

Expected result: Typing @if followed by two TAB presses of the keyboard should insert…

@if (true)
{

}

… with the true condition highlighted and ready to be changed. And then pressing the <kbd>Enter</kbd> key should put you in the middle of the block, the same as it would for a normal class/code file.


Original Comments

(no comments)


Original Solutions

(no solutions)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 19 (8 by maintainers)

Most upvoted comments

@JeepNL As I understand, this particular issue is currently tagged as a candidate to be fixed in the 17.1 release. I’m also with the understanding the November 8th release will be the 17.0 release, thus this will not be fixed for the initial GA release of VS2022.

I also must point out this has been tagged as an enhancement rather than a bug, despite working in VS2019 and not working now in VS2022.

I agree with you in principle-- code snippets have become second nature and seems like a huge miss for the VS2022 release.

On the other hand, I’m happy the Razor team has acknowledged and accepted the issue. I too am disappointed it’s only a candidate for 17.1 at this point. Seems much more urgent than that. But you can view the projects tab to see all the other work and issues being sorted by the team. So I have to trust the Razor team has their priorities.

I completely understand the sadness from you both and really appreciate the understanding that we’re doing our best here 😄.

When we originally set-out to get Razor’s editor updated in VS2022 there were a few motiviations:

  • Razor & C# Light bulbs
  • Hot reload
  • More reliable / less crashes
  • Don’t destroy your document
  • Improve formatting
  • LiveShare
  • Code re-use for other platforms
  • Personalized options
  • Performance
  • Open source!

Looking at the state of the world we found the VS2019 editor had hit its max capabilities in regards to the above goals yet still wasn’t enough. We were then met with the option to put an overwhelming investment into the pre-existing editor (working through legacy designs has a huge cost) or re-write pieces to set ourselves up for success. Given the Razor editor hasn’t gotten much love over the years we decided it’d be more efficient and a net-positive to do the re-write; also, it was the only option to allow us to get “most” things working for the VS2022 release. Anyhow, here we are nearing the VS2022 release and our journey is just starting. We’re keeping track of all of the feature parity issues (like tab + tab snippets) and working hard at bringing the high value features back into action as well as address as many high impact bugs as we possibly can.

Hopefully this little snippet helps explain some of the background. Again we really value your understanding here ❤️

There is a delay between the moment when fix is merged into main branch and VS release. There is 17.2 Preview 1 tag already marked but it is faaaar behind the latest changes of the repo. I suppose, this fix will be in 17.2, we just need to wait…

@NTaylorMullen, we do! And even if the Razor-reboot is a couple of steps back in order to reach a new generation, I’m actually happy you and your team are BOLD ENOUGH to make those kind of calls. I wish management where I am were that bold. Razor is the fabric that weaves together so many great technologies, so we appreciate everything you and your team are doing here. Thanks for responding and look forward to the upcoming release.

@JeepNL Apologies for the miscommunication! This got delayed slightly and will be coming in 17.2 Preview 2.0. The release notes should now be updated to correctly reflect that.

Not happy with this release, this is basic stuff, we need this asap…!

We hear your pain! We’re actively working at addressing these feature gaps!