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

Add support for remapping TextEdits & AdditionalTextEdits at resolve time. #6626

Merged

Conversation

NTaylorMullen
Copy link
Contributor

  • Migrated our old CompletionResolutionHandler logic for post-processing C# completion items to our new single server completion system.
    • One current gap is that the old system used to lookup active formatting options on the client to understand if snippets should be formatted with/without tabs etc. For now I'm using defaults but in a follow up PR i'll light up the real formatting options acquisition logic.
  • As part of this PR there were several pieces of code that could be re-used so I refactored them out. The TestRazorFormattingService is a prime example (especially now that completion resolve depends on it).
    • Did a few updates to the API so it was clear what type of formatting service you'd be getting (aka should it be HTML enabled?).
  • Added a test that validates that we get and remap text edit completions properly (I use await). I couldn't find a corresponding C# completion item that utilizes AdditionalTextEdits.

Enables

gif of await and override completion working

Most of #6618

…time.

- Migrated our old `CompletionResolutionHandler` logic for post-processing C# completion items to our new single server completion system.
    - One current gap is that the old system used to lookup active formatting options on the client to understand if snippets should be formatted with/without tabs etc. For now I'm using defaults but in a follow up PR i'll light up the real formatting options acquisition logic.
- As part of this PR there were several pieces of code that could be re-used so I refactored them out. The `TestRazorFormattingService` is a prime example (especially now that completion resolve depends on it).
    - Did a few updates to the API so it was clear what type of formatting service you'd be getting (aka should it be HTML enabled?).
- Added a test that validates that we get and remap text edit completions properly (I use `await`). I couldn't find a corresponding C# completion item that utilizes `AdditionalTextEdit`s.

## Enables

![gif of await and override completion working](https://i.imgur.com/EAwqM3j.gif)

Most of #6618
Copy link
Contributor

@allisonchou allisonchou left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@davidwengier davidwengier left a comment

Choose a reason for hiding this comment

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

Love how clean the test is

@NTaylorMullen NTaylorMullen merged commit e11a631 into nimullen/6618.formattingservicesnippets Jul 25, 2022
@NTaylorMullen NTaylorMullen deleted the nimullen/6618.resolve branch July 25, 2022 04:46
NTaylorMullen added a commit that referenced this pull request Jul 25, 2022
…time. (#6626)

* Add support for remapping TextEdits & AdditionalTextEdits at resolve time.

- Migrated our old `CompletionResolutionHandler` logic for post-processing C# completion items to our new single server completion system.
    - One current gap is that the old system used to lookup active formatting options on the client to understand if snippets should be formatted with/without tabs etc. For now I'm using defaults but in a follow up PR i'll light up the real formatting options acquisition logic.
- As part of this PR there were several pieces of code that could be re-used so I refactored them out. The `TestRazorFormattingService` is a prime example (especially now that completion resolve depends on it).
    - Did a few updates to the API so it was clear what type of formatting service you'd be getting (aka should it be HTML enabled?).
- Added a test that validates that we get and remap text edit completions properly (I use `await`). I couldn't find a corresponding C# completion item that utilizes `AdditionalTextEdit`s.

## Enables

![gif of await and override completion working](https://i.imgur.com/EAwqM3j.gif)

Most of #6618

* Address code review comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants