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

Support C# onTypeFormatting in Razor LSP (Part 1) #2213

Merged
5 commits merged into from
Aug 10, 2020
Merged

Conversation

ajaybhargavb
Copy link
Contributor

Fixes https://github.com/dotnet/aspnetcore/issues/23419

  • This is part 1 in a series of PRs to enable onTypeFormatting in C#
  • This PR contains the base infrastructure to supply edits from the client to the server, apply and format, and then send it back to the client.
  • The core formatting logic will follow in an upcoming PR. Splitting this out for ease of reviewing.

Copy link
Contributor

@TanayParikh TanayParikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@NTaylorMullen NTaylorMullen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@@ -158,6 +157,28 @@ public async override Task<TextEdit[]> RemapTextEditsAsync(Uri uri, TextEdit[] e
return remappedEdits;
}

public async override Task<TextEdit[]> RemapFormattedTextEditsAsync(Uri uri, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This signature should also include the snapshot because we can't know if the consumer is going to do more async work and therefore need to re-check document versions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add in the next PR

@ajaybhargavb ajaybhargavb force-pushed the ajbaaska/ontypeformatting branch from 61bf27f to 823f525 Compare July 22, 2020 22:45
* Core formatting logic wip

* Another validation pass and address feedback

* More feedback
…t part 3/3) (#2334)

* Added tests for onTypeFormatting and friends

* Feedback
@ajaybhargavb ajaybhargavb added the auto-merge Squash merge once all PR checks are complete and reviewers have approved label Aug 10, 2020
@ghost
Copy link

ghost commented Aug 10, 2020

Hello @ajaybhargavb!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 22d5fc4 into master Aug 10, 2020
@ghost ghost deleted the ajbaaska/ontypeformatting branch August 10, 2020 19:20
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge Squash merge once all PR checks are complete and reviewers have approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add embedded language FormatOnType support
4 participants