-
Notifications
You must be signed in to change notification settings - Fork 1k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
FeatureRequest: Support XML Comments on local methods #2110
Comments
I'm not really sure why you would ever want XML docs on local methods... since they're normally used for documenting the public API of your library and local methods are, by definition, not public. Can you give us an example of where you'd like XML comments to show up? Are you using it to document the throwing of exceptions rather than comments? |
I'm using it to say things like what the parameters do, contracts, what it might throw, what the method does, and random comments like "Performance Critical" I could of course use ad hoc comments to do all that, but I like the formal system of XML comments. I will point out that XML comments are allowed on private methods, where the same arguments could apply. |
I know it seems that the line is very thin between private and local methods but it's the same as the difference between fields/properties and local variables, isn't it? ... still I think that local methods are small (they're inside another method!) so you can just look at it to see what it does. |
I don't claim it's particularly important. It's more that if it's easy to do, I can't see any disadvantages to it, and I would find it useful. It doesn't add any complexity to the language. |
And yes, you can look inside the method, but you would still need a comment along the lines of |
For anyone on the LDM, Roslyn team: With this the sort of thing that if I were to hypothetically implement it and raise a PR, would it likely be merged, or does this still need the LDM to discuss it? |
Not on the LDM. However, my take on it is that this looks like this could be entirely done as a tooling change, with no need for any sort of language change. The more i think about it, the more i think it's basically entirely reasonable for any symbol (including locals) to have a doc-comment on it that can be used for tool-time help. These local doc-comments might never be emitted to a doc-file, but could still be used to inform the tooling side of things. I would recommend closing this issue and opening a request over at dotnet/roslyn. |
@CyrusNajmabadi |
See also #2110 I am championing this. |
would think the description for XML Comments be like :: XML Comments allows the developer to better organize the code; anything else about the productivity with XML Comments are manifestations from internet, example of product comment
|
I would find it to be a very helpful to be able to document local functions and have the documentation exposed in the IDE intellisense. |
You linked to the same issue. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Currently XML comments are invalid on local methods. As a result, if you add XML comments to local methods, they don't show up in intellisense.
Besides, I find it useful to document behavior of local methods, and having a fixed specification as to how to do so would be useful, rather than an ad-hoc comment system.
(Using XML comments on a local method also generates a warning in resharper that they are not placed on a valid language element, though obviously this isn't the relevant forum for that issue).
The text was updated successfully, but these errors were encountered: