-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Include a bit in DocumentId to indicate if it corresponds to a SG document or not #69952
Conversation
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.
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.
@CyrusNajmabadi This PR broke OmniSharp's ability to create DocumentIds for source generated documents. I will expose the new |
@JoeRobich ick :)
LMK what you thnik. |
@CyrusNajmabadi It isn't that we are making source generated docs but requesting them for use with GoToDef, etc... (see https://github.com/OmniSharp/omnisharp-roslyn/blob/22424c7a9635e5de0794ad97854ce37e7fdda1ad/src/OmniSharp.Roslyn.CSharp/Services/Navigation/SourceGeneratedFileService.cs#L37). O# has an EA lib and I was planning on updating it. Didn't know if there are potentially other users of this API who might break. grep.app doesn't know of many https://grep.app/search?q=DocumentId.CreateFromSerialized, github finds a few more https://github.com/search?q=DocumentId.CreateFromSerialized+language%3AC%23&type=code&l=C%23 |
Currently, the IDE has to always go down an expensive path when asked for teh Document corresponding to a particular DocumentId. This is because we don't know if the doc-id refers to a real user-documetn or a potential SG document. As such, if we don't find the real document, we have to go generate all the SG docs, even if they may not match teh doc id either.
This changes the internal representation of a DocId to include if it was synthesized to correspond to an SG doc or not. If not, we can shortcircuit those calls immediately, returning that no doc was found at all after hte fast user-code lookup. If it is an sg doc id, then we do go and do the more expensive work like we did before.