Skip to content
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

Closed
daniel-p-tech opened this issue Aug 16, 2020 · 5 comments
Closed

[Blazor] Suggestions for improved VS editing experience #4531

daniel-p-tech opened this issue Aug 16, 2020 · 5 comments
Labels
feature request Large improvement request
Milestone

Comments

@daniel-p-tech
Copy link

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 (without partial 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 to CompnentXYZ.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!

@ghost
Copy link

ghost commented Aug 17, 2020

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@allisonchou allisonchou transferred this issue from dotnet/aspnetcore Oct 2, 2021
@allisonchou allisonchou added this to the Backlog milestone Oct 2, 2021
@allisonchou allisonchou added the feature request Large improvement request label Oct 2, 2021
@NTaylorMullen
Copy link
Contributor

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.

@daniel-p-tech
Copy link
Author

This is great news, thanks for letting me know!

@daniel-p-tech
Copy link
Author

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

image

Thanks.

@danroth27
Copy link
Member

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.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request Large improvement request
Projects
None yet
Development

No branches or pull requests

4 participants