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

Auto generate triple slash comments with parameters #8

Closed
jrieken opened this issue Jan 20, 2016 · 9 comments · Fixed by #4261
Closed

Auto generate triple slash comments with parameters #8

jrieken opened this issue Jan 20, 2016 · 9 comments · Fixed by #4261

Comments

@jrieken
Copy link
Contributor

jrieken commented Jan 20, 2016

From @EmYeuCoGiao on December 25, 2015 3:43

I use VSCode for unity3d dev, i type /// but this not auto gennerate

///

///
///

///

capture

Copied from original issue: microsoft/vscode#1644

@jrieken
Copy link
Contributor Author

jrieken commented Jan 20, 2016

From @bpasero on December 25, 2015 10:17

This is currently not supported as far as I know.

@jrieken
Copy link
Contributor Author

jrieken commented Jan 20, 2016

From @EmYeuCoGiao on December 25, 2015 10:26

Thanks you for reply 👍

@DustinCampbell
Copy link
Member

This will require a new Roslyn API.

@dmccaffery
Copy link

There is a third-party extension that (mostly) provides this functionality:

https://marketplace.visualstudio.com/items?itemName=k--kato.docomment

What is required of roslyn to achieve this? The fact that it does not support navigating comments within the document?

@DustinCampbell
Copy link
Member

I need to expose a new API from Roslyn so that the same feature is not simply re-implemented inside of OmniSharp. Remember, this feature already exists in Roslyn today, and it's a little tricky to get right. The feature is not just generating XML doc comments on ///, but also inserting /// on enter, handling indents properly, getting undo behavior to be correct, not interfering with XML doc comment completion lists, etc.

What is required of roslyn to achieve this? The fact that it does support navigating comments within the document".

I'm not sure what you mean by this. There's nothing within Roslyn that disallows writing such a thing. Also, it's not clear to me why you would think navigating comments would be related to XML doc comment generation. Could you be a bit more precise?

As I mentioned, the feature already exists in Roslyn. I need to expose that feature as an API so that it can be used in OmniSharp.

@dmccaffery
Copy link

@DustinCampbell What I meant was, there was an issue sometime ago within Roslyn (probably specifically as it relates to analyzers) whereby navigating the document tree would not expose comment blocks -- it would skip over them. I assumed something similar might be in play here. At any rate, I am no expert when it comes to the roslyn APIs, so I will definitely take your word for it. :)

@DustinCampbell DustinCampbell modified the milestone: future Feb 7, 2017
@vanillajonathan
Copy link

It would be useful even if it didn't generate the <param> tags. Just inserting a blank template with a <summary> tag would be useful.

Also just basic intellisense for the common tags such as summary, para, c, returns, seealso, remarks, example, code would be use useful.

So even a basic one without Rosylin would be appreciated. :)

@bernardbr
Copy link

I'm using this extension: https://marketplace.visualstudio.com/items?itemName=k--kato.docomment and it solves the most common scenarios.

akshita31 added a commit that referenced this issue Mar 22, 2019
@osterhoutan
Copy link

Even just adding intellisense/code-completion for the xml tags like exists in visual studio would be amazing.
Especially since currently vs-code default code snippets do not work in C# comments.

333fred added a commit to 333fred/omnisharp-roslyn that referenced this issue Nov 23, 2020
IDocumentationCommentSnippetService was recently moved down to the Features layer, which means omnisharp can now take advantage of it and generate documentation comment snippets on typing. There are a couple of caveats:

1. LSP's "/onTypingFormat" endpoint has no support for setting the cursor location after format, which means that the cursor ends up after the inserted block. This is fine for newlines inside doc comments, but awkward for the initial expansion. However, unless we want to add special support with a custom endpoint, we can't get around this (the custom endpoint is how Roslyn does it).
2. The service itself is still internal, so I had to add a few new reflection points.

Server-side of dotnet/vscode-csharp#8. It also needs a vscode change, but it's a one-line change I'll submit later after we get this merged and I can write some integration tests.
333fred added a commit to 333fred/vscode-csharp that referenced this issue Dec 4, 2020
Adds '\n' and '/' to the on-type format list, enabling vscode support for the newly-added omnisharp feature of auto-generating documentation comments. Closes dotnet#8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants