-
Notifications
You must be signed in to change notification settings - Fork 199
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
Code action to offer to wrap Html attributes #11422
Code action to offer to wrap Html attributes #11422
Conversation
...t/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostCodeActionsEndpointTest.cs
Show resolved
Hide resolved
...icrosoft.CodeAnalysis.Razor.Workspaces/CodeActions/Razor/WrapAttributesCodeActionProvider.cs
Outdated
Show resolved
Hide resolved
...icrosoft.CodeAnalysis.Razor.Workspaces/CodeActions/Razor/WrapAttributesCodeActionProvider.cs
Show resolved
Hide resolved
if (first) | ||
{ | ||
firstAttributeLine = linePositionSpan.Start.Line; | ||
sourceText.TryGetFirstNonWhitespaceOffset(attribute.Span, out var indentSizeOffset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the Razor syntax tree continues to be annoying, so (almost?) all of the attributes start with whitespace. The syntax nodes look a bit like[<][foo][ class="asdf"][/>]
.
{ | ||
firstAttributeLine = linePositionSpan.Start.Line; | ||
sourceText.TryGetFirstNonWhitespaceOffset(attribute.Span, out var indentSizeOffset); | ||
indentSize = linePositionSpan.Start.Character + indentSizeOffset; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes #4296