-
Notifications
You must be signed in to change notification settings - Fork 833
Xml comment generation for generated signature files #11201
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
Conversation
|
I've done a pass through all of the functions in NicePrint and I think I've covered all of the relevant ones, but it's tough to know that I've hit them all of course. |
332158e to
2c94742
Compare
Probably. Adding another field to
I wouldn't worry about what else is missing; they can be addressed separately from this PR.
I think a few simple equality tests proving that the comments actually get emitted is sufficient for now. Use this PR as an example/guidance on where to put tests: #11303 - but if you find a better place to put them, that's also fine too :).
I would add a check to not emit the documentation if the Entity is a |
|
Thanks for the comments @TIHan, I'll look into addressing them. |
2c94742 to
29553b9
Compare
|
The failing tests right now are: and this is probably a reasonable failure, but I'm not sure what the resolution is. I'm not familiar with this area of the codebase. Any pointers? |
|
Since these are VS tests, and the older ones that are more difficult to work with, it'll be annyoing. The test is more or less asserting that a tooltip in VS will show the signature, followed by the summary comment. That's apparently no longer true with this work. It's a weird abstraction being used so it's kind of hard to build a model for how to make the test pass, but a quick way to see if you've fundamentally borked tooltips is to build this version of the tools and have the following code: module MyModule =
/// Union comment
type Union = /// Case comment
| Case of int
let x () =
Module.And see what the tooltip for |
|
So I've gotta go install VS and learn how to build the vsix/run the debug hive stuff? That makes me le sad. |
|
Yep :) Luckily it's not too bad. Just set VisualFSharpDebug as the startup project and hit ctrl+f5 (or f5 to debug if you like it slow). |
|
Definitely doing weird stuff now: The entire union definition is inlined into the tooltip, which when xml comments are included can make the tooltip unusable. My guess is I'll have to modify the displayenv that's used in whatever routine this is to toggle the documentation generation off for that pathway. |
|
Alright, so this is because the
There are a few potential fixes here:
Of these two, I prefer option 1, but am open to other ideas. |
|
Option 1 sounds much more preferable to me. |
|
I just tested option 1, and the end result is just that xml comments aren't rendered in the types. They are still part of the tooltip overall for the member being examined: (see the |
|
Thinking a bit more on this, the reason I even had to make a change in the VS tools was because I opted documentation generation on by default for layout. I now think this is a mistake. Instead, I want to:
|
|
It looks like the only test failure is a timeout on linux :-/ |
cartermp
left a comment
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.
I like this a bunch, but will definitely want a thorough @TIHan review.
| showOverrides = true | ||
| showConstraintTyparAnnotations = true | ||
| showDocumentation = true | ||
| showDocumentation = false |
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.
Yes, by default it should be false.
|
|
||
| open FSharp.Core.Printf | ||
|
|
||
| let debug = false |
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.
We can get rid of this I think.
TIHan
left a comment
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.
Great work! This is going to be extremely helpful.
|
I'm going to merge it in. If anything, I'll make a PR with some minor tweaks if they come up as I'm still working in this space. |


Today, the compiler doesn't include XmlDoc comments in generated signatures, which can present a maintainability/usability problem. With the advent of compiler performance improvements in the presence of signature files, we should ensure the onboarding experience for authoring signatures is as easy as possible. To that end, this PR adds in emit of xml documentation where is is already known.
This initial implementation is quite simple, the entire complexity comes from auditing where comments are known and ensuring that the matching call to
layoutXmlDocis called.I've been using the following sample file for testing, and manually comparing the generated output:
Script.fs
Output at this point is:
generated signature
Open questions: