Skip to content

Conversation

@davidwengier
Copy link
Member

Fixes #6711

Sorry for the size of the PR. Recommend reviewing change-at-a-time. Most changes were done mechanically with the rename function in VS (and I only had to log 3 bugs against Roslyn while doing it!)

Things this does:

  • Change from "MapToProjected" and "MapFromProjected" to instead use "MapToGenerated" and "MapToHost"
  • Change all other instances of "virtual" or "projected" to be "generated"
  • Change anything that was "original" to be "hostDocument" to be clearer
  • Use an interface instead of an abstract class
  • Rename classes to get rid of the "Default" prefix
  • Move some code to extension methods where it didn't need to be in the service

There are still a couple of things that use the term "virtual", but I limited this PR to the document mapping service to keep things sane. Its a super important service though, so it deserves some love.

@davidwengier davidwengier requested a review from a team as a code owner May 30, 2023 04:12
Copy link
Member

@DustinCampbell DustinCampbell left a comment

Choose a reason for hiding this comment

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

Fantastic! However, it feels like there's still some work to do here to update parameter and variable names to get rid of the "projection" terminology.

@davidwengier
Copy link
Member Author

it feels like there's still some work to do here to update parameter and variable names to get rid of the "projection" terminology.

I was focusing on the API itself, so new uses would fall into the pit of success, as I thought the PR would be big enough already, but if my audience demands it, far be it from me to deny you of even more commits!

Will update :D

@DustinCampbell
Copy link
Member

I was focusing on the API itself

Parameter names are API 😄

/// generated document. If the uri passed in is not for a generated document, or the range cannot be mapped
/// for some other reason, the original passed in range is returned unchanged.
/// </summary>
Task<(Uri MappedDocumentUri, Range MappedRange)> MapToHostDocumentUriAndRangeAsync(Uri generatedDocumentUri, Range generatedDocumentRange, 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.

Suggested change
Task<(Uri MappedDocumentUri, Range MappedRange)> MapToHostDocumentUriAndRangeAsync(Uri generatedDocumentUri, Range generatedDocumentRange, CancellationToken cancellationToken);
Task<(Uri HostDocumentUri, Range MappedRange)> MapToHostDocumentUriAndRangeAsync(Uri generatedDocumentUri, Range generatedDocumentRange, CancellationToken cancellationToken);

If I'm understanding this correctly, the host document URI is returned by this (under new terminology)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, thats right.

Copy link
Contributor

@ryzngard ryzngard left a comment

Choose a reason for hiding this comment

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

Admittedly did not look at every file, but the renaming and new interfaces look correct to me.

@davidwengier davidwengier merged commit 79ee154 into dotnet:main Jun 1, 2023
@davidwengier davidwengier deleted the CleanupDocumentMapping branch June 1, 2023 00:29
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.

Change usage of "projected" document to something else

3 participants