Open vsfeedback opened 3 years ago
More reports:
please bring back this usefull feature !
Any feedback about this?
How hard can this be to implement.
At least for C# code it must be very easy to fix. So annoying that this not working.
Visual Studio 2022 Please can this bee looked in to!? I can use 'surround with' and 'insert snippet' in any .cs file, but not .cshtml, .html or any HTML page!? Why on earth was this feature taken away? 😕
Another vote to bring this back. You're telling me Elon Musk can land rockets vertically but you can't surround some highlighted code with a user-provided text string? Come on, guys.
Hi folks. Just a heads up that Surround With is actually available in .razor files as a keyboard shortcut: Alt+Shift+w. It's just not available as a menu item.
Is the keyboard shortcut sufficient?
Hi folks. Just a heads up that Surround With is actually available in .razor files as a keyboard shortcut: Alt+Shift+w. It's just not available as a menu item.
Is the keyboard shortcut sufficient?
A little bit of an awkward keystroke but I'll take it. Thank you.
This Alt+Shift+W is a start, but it only surrounds with <div>
. I believe what we're all after is a proper surround with that then presents a list of tags that one can use to surround the highlighted text.
Thanks @Brascal for this feedback! Please note that after the div
is generated it is selected so that you can rename it to whatever element you want, which will rename both the opening and closing tags. I understand this isn't exactly the experience you're asking for, but I want to make sure folks are aware that you can still use Alt+Shift+W to pretty quickly surround content with arbitrary elements.
@danroth27 you are right! Somehow that capability escaped me; thanks for pointing that out.
I was also about to point out that Alt+Shift+W puts the new <div>
s on the same line as your selected element, which then requires further manual manipulation to get all three elements on their own line. However I found that if the text selection includes a trailing newline, Alt+Shift+W will place the <div>
s on their own lines, as desired.
Another note: you can change the shortcut if you prefer. It's set in Tools > Options > Keyboard
like this
And this only works in the HTML part, not in the code block. So I have to put the c# code in a file behind, to make use of a surround (with).
As per the screenshot above, the "surround with" that is available in .razor files, in Html, is actually the "Wrap With Div" command from Html. Alt+Shift+W is the default keybind.
Ctrl+K, Ctrl+S is Edit.SurroundWith, which is for a specific type of snippet, and has a custom UI in VS that is not currently available with the technology that the Razor editor uses. This issue is tracking that latter piece.
Huge Up for this last comment, as it clarifiers the differences between the two. I don't see how the "surround with element" got here. The issue I am facing too is related to the c# code sections, not the html markup. Actually, they should have been addressed with the same feature/widget just context sensitive. But currently these two are different things for whatever reason. And I am really missing it in the code sections. Made report too. The fact that this is such an old or recurring issue is just annoying.
This issue has been moved from a ticket on Developer Community.
I'm trying to apply Surround With to HTML elements and VS says the command is not currently available. I am using latest preview of VS 2022.
Original Comments
Feedback Bot on 7/21/2021, 11:44 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Feedback Bot on 7/26/2021, 03:29 PM:
Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.
Original Solutions
(no solutions)