Open Herdo opened 3 weeks ago
I have played around with this idea. Happy more people want it :)
I've played around with it for a little bit and got it working for the most part. I've encountered a "major" issue, though, which seems to be known by Microsoft, but is not on the roadmap to be implemented: Snippets in the Razor editor are barebone. They do not support:
Function, Declarations, Id, Import(s), Keyword(s), Literal, Namespace, Object, Reference(s), or Command https://github.com/dotnet/razor/pull/9327#issue-1914492231
The snippets work as expected in normal C# files, though. You can have a look at the attached code. BlazorSnippets.zip
P.S.: Required using
statements could be triggered as well, but most likely they are already in place through GlobalUsings.cs
.
I think the Blazm extension might be the right place to use some common code snippets for Blazor, as this extension already bundles some other amazing features!
Visual Studio supports distributing code snippets with extensions: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-distribute-code-snippets
Some suggested snippets that come to my mind, which could be included with this extension:
Snippet codes could end with Blazm as well, and there's probably a ton more to add from other peoples experience.