-
Notifications
You must be signed in to change notification settings - Fork 219
Make RazorDocumentMappingService easier to understand #8775
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
Make RazorDocumentMappingService easier to understand #8775
Conversation
In the perfect illustration of why "Projected" is a bad term, this method was named completely backwards to what it actually does :)
I thought it would be easier to differentiate "Host" vs "Generated" in completion, versus "From" and "To"
Interestingly this method is not used outside the service. Could be removed from the interface if we really wanted I guess.
...oft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs
Outdated
Show resolved
Hide resolved
...oft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs
Outdated
Show resolved
Hide resolved
...oft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AbstractRazorDelegatingEndpoint.cs
Outdated
Show resolved
Hide resolved
...crosoft.AspNetCore.Razor.LanguageServer/Extensions/IRazorDocumentMappingServiceExtensions.cs
Outdated
Show resolved
Hide resolved
...crosoft.AspNetCore.Razor.LanguageServer/Extensions/IRazorDocumentMappingServiceExtensions.cs
Outdated
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.
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.
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 |
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); |
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.
| 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)
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, thats right.
ryzngard
left a comment
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.
Admittedly did not look at every file, but the renaming and new interfaces look correct to me.
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:
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.