-
Notifications
You must be signed in to change notification settings - Fork 219
Cohost span mapping #12055
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
Cohost span mapping #12055
Conversation
…ts (#79604) Part of dotnet/razor#9519 Half of the fix for dotnet/razor#12054, along with the Razor side at dotnet/razor#12055 Previously I allowed rename to work on any source generated document, but made it only opt in for when the rename request came from Razor. Now that we have a little more time for development, it's time to finish the feature off properly. This PR: * Rename will only consider source generated documents if they're from Razor * Any rename operation will automatically do so, without opt in * Before applying changes to the workspace, we call in to Razor to map edits * This matches the behaviour of non-cohosting, but that does edit mapping via a document service. Since with cohosting Razor doesn't control the document creation, there is no way to set up a document service, so there is just a workspace service that does the same thing. There will still need to be more PRs to make this work in VS Code, and to hook up the span mapping aspect of the service, but I didn't want this PR to get too big.
|
Gonna wait for dotnet/roslyn#79677 and do this and span mapping at the same time, because I tweaked the API in the EA layer. |
| { | ||
| public static bool IsRazorSourceGeneratedDocument(this RazorGeneratedDocumentIdentity identity) | ||
| { | ||
| return identity.GeneratorTypeName == typeof(RazorSourceGenerator).FullName; |
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.
When would we ever have a RazorGeneratedDocumentIdentity that wasn't from our source generator?
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.
When I wrote this, yeah, we could get them when, for example, you renamed a method from a Razor file, where the method was defined in C# and generated by the System.Text.Json or Regex generators. I've made recent changes in Roslyn to rename that prevents that now, but it wouldn't take much change on the Roslyn side for that to be undone.
Fixes #12054
Part of #9519
Needs
dotnet/roslyn#79604 anddotnet/roslyn#79677 to insert before this will buildThis PR implements the workspace version of our span mapping service, since the old one is hooked up via a document service, which we can't do in cohosting.