Skip to content
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

Generate external annotations #174

Open
ka4ep opened this issue Jul 23, 2019 · 5 comments
Open

Generate external annotations #174

ka4ep opened this issue Jul 23, 2019 · 5 comments

Comments

@ka4ep
Copy link

ka4ep commented Jul 23, 2019

Are there any plans to provide an automated synchronized way to switch between use of annotations.xml and code attributes, possibly choosing annotations source?

Imagine an external repository which is being forked. The source code has no annotations and originally coded without the use of R#. So I put annotations wherever possible, getting all sorts of NRE possible bugs fixed. Now I have a JetBrains.Annotations package dependency in every project and repository maintainer wouldn't accept a PR with that.

A good solution is to ship a xml along with PR, but there's a problem...
ExternalAnnotations.xml is not being generated automatically from annotated code and not quite trivial to build manually.

By adding attributes in code ([NotNull] etc.) these could be automatically added into xml and then shown from these. And then NuGet package reference wouldn't be necessary in the first place as well as attributes themselves in the code.

@sirduke
Copy link
Contributor

sirduke commented Jul 23, 2019

External (xml) annotations are not supported for source code, only for assemblies.
There is alternative way to adding dependencies to "JetBrains.Annotations" is to embed annotation's declarations in you source code, see https://www.jetbrains.com/help/resharper/Code_Analysis__Annotations_in_Source_Code.html

@michael-damatov
Copy link

We have a lot of generated code in our solution, but we cannot change the way they generated. It would be nice to apply the external annotations for the source code in such a case.

@ka4ep
Copy link
Author

ka4ep commented Jul 24, 2019

I guess this is the only way for now and requires far less effort for anyone.
Is there any description in the R# SDK on how an xml is read and mapped onto source code? I may give a thought if any automation possible.

@sirduke
Copy link
Contributor

sirduke commented Jul 24, 2019

I think it is better to create feature request in ReSharper's youtrack ( https://youtrack.jetbrains.com ) to support xml external annotations for source code

@ngbrown
Copy link

ngbrown commented Oct 19, 2019

Generating external annotations from a forked library would also be a quick way to create the annotations for this repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants