This repository was archived by the owner on Jun 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 75
Adds support for generating proxies at design-time from the IDE #4
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds analyzer and codefix to detect ProxyGenerator-annotated method invocations and generates and adds a proxy for them in the IDE via a codefix. This required a minor refactoring of the proxy generation we had, pretty much everything is reused as-is. Created a separate Proxy.Sdk that contains the document visiting/generation interfaces so that third parties can extend this process via MEF in the IDE natively, or via the existing MSBuild-based mechanism for the compile-time generation and discovery.
This makes the code a bit cleaner and easier to follow
By switching to None cancellation token, we make it easier to debug and pause for longer times while inspecting the code generation from within the IDE, that would otherwise be canceled automatically by VS.
This ensures that P2P nuget references get the right dependency versions
Ultimately applying the changes in the doc should be a responsibility of the caller that's transforming the doc. In a codefix (IDE-based generation of the proxy), this method is called to display a preview of the changes, so we most certainly don't want to force it to apply to the current workspace (the opened solution!) before the user actually commits the changes. VS handles that for us automatically. Also, since the IProxy interface is added at the Rewrite phase after the other types have been visited, it's not necessary to skip applying code fixes for it since there will never be any.
The preview now works with project references and in VB too.
No need for the overhead of compile-time generated ones.
This is super useful when the Returns invocation itself modifies parameters or state, so the callback can use those.
Simplified formatting and whitespacing.
… name The only way to now generate proxies that do not contain the additional interface names in the proxy name is by using the MEF document visitors. This simplifies the code and makes it easier to reuse from the code fixes.
The <CompilerGenerated> attribute was not properly separated from the namespace declaration.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds analyzer and codefix to detect ProxyGenerator-annotated method invocations
and generates and adds a proxy for them in the IDE via a codefix.
This required a minor refactoring of the proxy generation we had, pretty much
everything is reused as-is.
Created a separate Proxy.Sdk that contains the document visiting/generation
interfaces so that third parties can extend this process via MEF in the IDE
natively, or via the existing MSBuild-based mechanism for the compile-time
generation and discovery.