-
Notifications
You must be signed in to change notification settings - Fork 204
"format document" does not work properly with textareas in Blazor razor #11622
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
Comments
Repros in both new and old formatting engines. I think textarea formatting is weird Simple repro:
|
Yep, as expected, the Html formatter doesn't move the closing tag (presumably since the whitespace before it, being part of the text area, is significant), so we think it wants it to be indented 4 spaces, and we want 4 spaces due to the |
Please note, that outside the code block, it also does not work as expected: The closing tag should align with the opening tag. |
That's not up to us, but rather up to the HTML formatted, and it looks like it doesn't want to move it. Which makes sense because if the start tag was at column 0, but the end tag was at column 4, then moving the end tag would remove 4 spaces of user data from the text area. Either way, once you get the update if there is a change in formatting you want to see, you can log a VS Feedback issue and we can route it to the right team. We at least won't move the close tag endlessly to the right anymore :) |
@PhilippJR The fix for this issue is in VS 17.14 Preview 3 |
OK, thanks for the quick response. |
Would need to see more info to know if the issue you're hitting is an existing one. Can you reproduce the issue in a new project that would allow you to post the whole file contents? Seems like there must be something that the formatter isn't handling, but its not present in the screenshots. Also feel free to log a new issue, so its easier to keep track of when the fix is made. |
Oh, is your project multi-targeted to more than one version of .NET? #11646 works around a bug related to that, which could have caused the behaviour you're seeing too. Also 17.14 P3 though |
No, it is not. |
Hm, I cannot reproduce it with a new project. Sorry, I know without being able to reproduce it, this does not help. I'll let you know, if I find out more. |
Hi, this morning, I worked on a file with a textarea and when I formatted the document with CTRL+k,d, my textarea closing tag again moved to a wrong position. So, I remembered that 17.14 is available and updated VS from 17.13.x. 17.14.mp4The textarea closing tag moves to to the right as well as line broken items in the span. The span closing tag is moved to the left. For reproduction, I copied my code to Home.razor of a new Blazor Wasm project, deleted some things and replaced classes that did not exist. CTRL+k,d resulted in the same misformatted file. Please try yourself. Simply paste below code that I formatted by hand. Then, hit CTRL+k,d or already see what's wrong when "format on paste" is activated.
|
Thanks for the report @PhilippJR, but can you please log a new issue for it though, so it doesn't get lost? Comments on closed issues are easy to miss and I'm travelling for a couple of weeks at the moment. |
Sure, here it is. |
Uh oh!
There was an error while loading. Please reload this page.
This issue has been moved from a ticket on Developer Community.
In my Blazor project, I often use CTRL+K, CTRL+D to format my documents, but there is a bug, when in Razor, there is a textarea inside of a code block. Please see attached screencast.
B62dac05b45ac464692578b602618e488638774719490215504_textarea_bug_in_razor.mp4
Original Comments
Feedback Bot on 14/03/2025, 01:56 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.
The text was updated successfully, but these errors were encountered: