-
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
Support C# onTypeFormatting in Razor LSP (Part 2) #2259
Support C# onTypeFormatting in Razor LSP (Part 2) #2259
Conversation
...Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
Show resolved
Hide resolved
...src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CodeBlockDirectiveFormattingPass.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingPassBase.cs
Show resolved
Hide resolved
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.
Only had clarification comments / a few null check suggestions. I think the design is spot on. Really impressed by how clean and well-factored this all is. Formatting is an incredibly difficult problem to begin with and you built an API to make it as understandable as humanly possible. In the end, I somehow understood that super hard problem of formatting because of the choices you made. Bravo sir, color me impressed!
👏 💯 🥳 🎉
...Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
Show resolved
Hide resolved
...Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
Show resolved
Hide resolved
...Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
Show resolved
Hide resolved
...Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
Show resolved
Hide resolved
...Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingPassBase.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingPassBase.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingSpan.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IFormattingPass.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SourceTextExtensions.cs
Show resolved
Hide resolved
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.
👏 LGTM, just a few comments:
...Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
Show resolved
Hide resolved
.../src/Microsoft.VisualStudio.LanguageServerClient.Razor/HtmlCSharp/OnTypeFormattingHandler.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/TextLineExtensions.cs
Outdated
Show resolved
Hide resolved
218d138
to
a4ddc1c
Compare
Updated some logic and added another validation pass. Also addressed feedback. I plan to put the test changes in a separate PR for ease of reviewing. |
...Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
Show resolved
Hide resolved
...Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/CSharpOnTypeFormattingPass.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingContext.cs
Show resolved
Hide resolved
...rc/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingStructureValidationPass.cs
Outdated
Show resolved
Hide resolved
...rc/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/FormattingStructureValidationPass.cs
Show resolved
Hide resolved
Merging this with Part 1 so I can rebase with master easily. |
* Core formatting logic wip * Another validation pass and address feedback * More feedback
* Support C# onTypeFormatting in Razor LSP * feedback * feedback * Support C# onTypeFormatting in Razor LSP (Part 2) (#2259) * Core formatting logic wip * Another validation pass and address feedback * More feedback * Added tests for onTypeFormatting and friends (onTypeFormatting support part 3/3) (#2334) * Added tests for onTypeFormatting and friends * Feedback
Part of https://github.com/dotnet/aspnetcore/issues/23419
FormattingContentValidatorPass
to ensure the integrity of the document before returning formatting editsWorking on: