-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Blazor] Suggestions for improved VS editing experience #4531
Comments
Thanks for contacting us. |
Hi @daniel-p-tech, in latest VS2022 builds we've brought forward the ability to "View Code" for C# files (wont create one if it's not already there); however, creating CSS/JS doesn't exist quite yet. Interesting idea though! I'll leave this open for more folks to share their feedback. |
This is great news, thanks for letting me know! |
@NTaylorMullen the "View Code" menu item seems to be missing when I create a new razor file. If I open a razor file that already has "XYZ.razor.cs" file then the option is available. I'm running VS 17.0.0. Thanks. |
You can now extract code blocks from .razor files to a code-behind file using a quick action. You can also navigate between the code-behind and the original Razor file using the F7 keyboard shortcut, although we don't provide a context menu item for this or for navigating to .razor.css or .razor.js files. VS does support formatting .razor files using the normal format document gesture. Since this issue is currently tracking multiple feature requests, I'm going to close it and break the remaining items out into separate issues so they can be independently triaged and voted on (👍) by the community. |
Hello team,
I suspect many developers using Blazor come from WPF/WebForms environment and prefer clean separation of UI markup and C# code. VS currently supports rather cumbersome way of creating
CompnentXYZ.razor.cs
file (withoutpartial
keyword that still needs to be supplied manually). I would like to suggest implementation of "View Code" context menu in both Razor editor and Solution Explorer (just like in WebForms) that would switch toCompnentXYZ.razor.cs
file or create one if it does not exist. Now that CSS/JS isolation is being developed, this concept can be expanded to "View CSS" and "View JS" context menu option as well.Second suggestion is to implement a VS tool to reformat Razor code (again something similar to WebForms). I find myself often breaking the layout of Razor code by making small changes (creating new nested components etc) and to my knowledge there is no automated way to fix the formatting.
Thanks!
The text was updated successfully, but these errors were encountered: