0

Is there a way that I can create my own custom snippets for Blazor files in Visual Studio 2022? I'm able to create custom snippets for C# using <Code Language="CSharp"> in the .snippet file however, there is no such thing as <Code Language="blazor">. I can import using CSharp or HTML for code language but I'm unable to use it while coding on *.razor files. The shortcut shows up when I start typing but hitting tab does not bring the code snippet.

Is there any workaround or extension that can do this?

1 Answer 1

1

Currently, Visual Studio does not support creating custom snippets for Razor, so something like or won't work. You can check the supported languages here: Code snippets schema reference.

Apparently, only built-in snippets work in *.razor files. You can find a discussion and some suggestions to work around this limitation, such as editing built-in snippets or using the legacy editor, in this issue: 6397.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.