-
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
Connect open source generated files to the workspace #52094
Connect open source generated files to the workspace #52094
Commits on Apr 24, 2021
-
Configuration menu - View commit details
-
Copy full SHA for c02935e - Browse repository at this point
Copy the full SHA c02935eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 1eb4e64 - Browse repository at this point
Copy the full SHA 1eb4e64View commit details -
Configuration menu - View commit details
-
Copy full SHA for f390925 - Browse repository at this point
Copy the full SHA f390925View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3a1bc6f - Browse repository at this point
Copy the full SHA 3a1bc6fView commit details -
Parse generated text the same way we do regular files
Now that the compiler doesn't actually parse generated files eagerly, we can use the same parsing mechanism we do for parsing regular trees. This removes some duplication and also will set us up to have forked solutions where we have generated trees that didn't come from the compiler at all.
Configuration menu - View commit details
-
Copy full SHA for 513570f - Browse repository at this point
Copy the full SHA 513570fView commit details -
Extract out the common DocumentId/hint name/generator identity values
We pass these around as a group on a fairly regular basis, so let's just make them a single type.
Configuration menu - View commit details
-
Copy full SHA for 8eebd97 - Browse repository at this point
Copy the full SHA 8eebd97View commit details -
Configuration menu - View commit details
-
Copy full SHA for 11f1d4b - Browse repository at this point
Copy the full SHA 11f1d4bView commit details -
Extract out an interface for CompilationTracker
This is just the invocation of the extract interface refactoring and then some immediate follow-ups to trivially retarget types.
Configuration menu - View commit details
-
Copy full SHA for 4d36e8c - Browse repository at this point
Copy the full SHA 4d36e8cView commit details -
Allow GetOpenDocumentInCurrentContextWithChanges to return generated …
…documents The overall approach here is to make GetOpenDocumentInCurrentContextWithChanges work to return SourceGeneratedDocuments like anything else. The strange bit is we have to ensure the source generated document matches the text that's currently in the buffer. Consider a case where: 1. The user makes a change in another file which means the generator will produce new results. That generator is running async. 2. The user switches back to the generated file and immediately invokes a command on it before we refresh the buffer contents. In that case, the buffer contents are stale, but we need to ensure the SourceGeneratedDocument given to all our features is in sync with the actual text buffer, or otherwise spans and everything won't align. This is very similar to the general concept of the "with changes" portion of that API: you may always get a forked version of the world that doesn't represent an entirely consistent view of the entire world, but it's at least going to ensure your document matches your starting point. In the "regular case" that the generator has already ran and we're able to confirm the contents of the text buffer still matches the generated output, this (like for regular documents) doesn't fork anything at all -- you end up with the Solution object that matches Workspace.CurrentSolution. The implementation approach here is to ensure that when we do fork a snapshot the final Compilation has the tree matching the text present no matter what. One approach would have been to fork the compilation tracker with some extra special state that remembers to fix that up in the end but I had two concerns with that approach: 1. The compilation tracker implementation is already crazy complicated. 2. Forking the compilation tracker while a generator is running potentially now running generators twice depending on the timing. I decided to take the approach that CompilationTracker has an interface extracted for it's actual surface area, and then when we do the forked solution we create a different implementation of that interface that forwards to the underlying implementation and then replaces out the tree at the very end. This means we don't ever have generators running twice, and the magic of swapping out the tree is all contained in the special implementation and the core implementation is untouched.
Configuration menu - View commit details
-
Copy full SHA for d14879f - Browse repository at this point
Copy the full SHA d14879fView commit details -
Configuration menu - View commit details
-
Copy full SHA for d3670be - Browse repository at this point
Copy the full SHA d3670beView commit details -
Ensure GeneratedFileReplacingCompilationTracker.ContainsAssemblyOrMod…
…uleOrDynamic works This is a naive implementation that simply ensures we don't get different behavior from the main implementation. Most of this change is just moving the creation and matching logic into UnrootedSymbolSet.cs itself.
Configuration menu - View commit details
-
Copy full SHA for 25ddeb7 - Browse repository at this point
Copy the full SHA 25ddeb7View commit details -
Update GetRelatedDocumentsWithChanges to work with open generated files
This works the same as the GetOpenDocumentInCurrentContextWithChanges. This fixes navigation bars specifically which use this.
Configuration menu - View commit details
-
Copy full SHA for 67a0994 - Browse repository at this point
Copy the full SHA 67a0994View commit details -
Stop holding onto ISourceGenerators in our document identity
We were holding onto the ISourceGenerator instance and passing it around for various reasons; this decomposes it into holding onto the assembly name and type name strings, so we can serialize this across processes.
Configuration menu - View commit details
-
Copy full SHA for 715efec - Browse repository at this point
Copy the full SHA 715efecView commit details -
Dynamically connect the source generated file to the workspace
We don't know up-front whether a generated file exists in the workspace, and our APIs to grab a document from a buffer are intended to complete quickly. If it turns out later the file isn't in the workspace anymore we will fake it and add it back so that way features aren't surprised by this. However, that means semantics in that file may be inaccurate. Disconnecting the document means that once the file is gone, then we won't be in this incorrect state for long.
Configuration menu - View commit details
-
Copy full SHA for af6ba45 - Browse repository at this point
Copy the full SHA af6ba45View commit details -
Rename infoChecksum to attributesChecksum
It's a checksum of the attributes, not info, which can be confusing here.
Configuration menu - View commit details
-
Copy full SHA for 5311268 - Browse repository at this point
Copy the full SHA 5311268View commit details -
Configuration menu - View commit details
-
Copy full SHA for eb50444 - Browse repository at this point
Copy the full SHA eb50444View commit details -
Configuration menu - View commit details
-
Copy full SHA for a0736e8 - Browse repository at this point
Copy the full SHA a0736e8View commit details -
Remove WellKnownSynchronizationKind.RecoverableSourceText
This isn't actually used by anything.
Configuration menu - View commit details
-
Copy full SHA for 1ca9662 - Browse repository at this point
Copy the full SHA 1ca9662View commit details -
Add an assert when we are sending a null value
We already had an assert that we shouldn't read one, but this adds the same assert on the sending side where it's easier to debug the source of the problem.
Configuration menu - View commit details
-
Copy full SHA for 4ef0074 - Browse repository at this point
Copy the full SHA 4ef0074View commit details -
Tweak how null checksums are handled during solution sync
There are a number of asserts which try to ensure that we don't try to sync a null across the wire during solution sync. If you wanted to try using Checksum.Null as a placeholder for an optional value during synchronization, you'd hit these asserts because not everything would filter them out. This change filters them out during some parts of the synchronization process, allowing it to be used as an optional value.
Configuration menu - View commit details
-
Copy full SHA for f8fd45e - Browse repository at this point
Copy the full SHA f8fd45eView commit details -
Synchronize the state of frozen source generated documents
The solution has the concept of "frozen" source generated documents where we force a solution snapshot to have a source generated document of a certain content, even if the generator is producing something new. This allows us to isolate features operating on a source generated document open in the editor that hasn't been updated yet -- we freeze the contents of the source generated file to match the open buffer, so taggers and the like can still function normally. This commit ensures that we synchronize those to the OOP process so everything stays in sync. The primary counter-intuitive bit is why we're holding onto this information at the SolutionState level, but that's because the place where the information is ultimately needed is the compilation trackers, which are held by the Solution object and nowhere else. This allows us to reuse the underlying project states for maximum efficiency.
Configuration menu - View commit details
-
Copy full SHA for b615e21 - Browse repository at this point
Copy the full SHA b615e21View commit details -
Add an option to control source generated files being opened
Since we want to put this into 16.10 but we're past the feature cutoff, we'll put this behind an experimental flag.
Configuration menu - View commit details
-
Copy full SHA for 02e62fa - Browse repository at this point
Copy the full SHA 02e62faView commit details -
Configuration menu - View commit details
-
Copy full SHA for cc4961d - Browse repository at this point
Copy the full SHA cc4961dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7020a27 - Browse repository at this point
Copy the full SHA 7020a27View commit details