-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Quick Fix: Add parameter to documentation #5611
Comments
@cmatskas Awesome! |
@rchande sorry for sounding silly but where in the code do you see this error message? the closest I can get to it is in SymbolDisplay.cs but there's no ISymbolDisplayCache param in any of the inline methods? Any pointers would be greatly appreciated :) thanks |
@cmatskas I noticed it while adding the cache (and it hasn't been merged) 😄 . There's a much shorter snippet where you can see it: class Program
{
/// <param name="args"></param>
static void Main(string[] args, int args2)
{
}
} |
Apologies folks but I may have to forgo this one. The solution crashes my VS2015 and all my attempts to even build it have failed. Back to the backlog as I cannot work on this :( |
@cmatskas could you file a bug with the build errors so we can try and figure out why you can't build on 2015? |
@jmarolf Sure, I'll open a new bug and attach a gist with the error messages. thanks |
@cmatskas no, thank you! |
Bug raised as #5656. I would be really keen to work with someone from the team to get this resolved and maybe contribute a fix or two (or more). |
@cmatskas Glad you got your solution working! How much background do you have in Roslyn? I would write this as a CodeFixProvider(http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/CodeFixes/CodeFixProvider.cs,0ea452288308834d) that responds to that particular error ID and fixes the error by adding the missing parameter to the documentation. If you do this, when that error appears, you'll be able to type Ctrl-. and see the fix appear in the light bulb menu. |
I'm interested in contributing here. Is there still any interest in this? |
@3jr definitely! We're still interested in this. |
I think it makes sense to apply this CodeFix to many items with a ParameterList and do something very similar for TypeParameterLists (a corresponding warning exists: CS1712). VB doesn't have such a Warning, so no CodeFix for VB? I have some issues with formatting (especially with Current Behavior(I'm totally willing to change this!)
(*): The previous parameter in the method or indexer, etc. ParameterList. Issues with the current behaviorIn the example /// <param name="arg1"></param> <param name="arg2"></param> <param name="arg4"></param>
static void M1(int arg1, int arg2, int arg3, int arg4) { } the current behavior leads to /// <param name="arg1"></param> <param name="arg2"></param>
/// <param name="arg3"></param> <param name="arg4"></param>
static void M1(int arg1, int arg2, int arg3, int arg4) { } potentially one could think of the following as issues
I think issue (1.) could be fixed but it's not obvious which indentation to use (and I couldn't yet figure out a way to compute one). For issue (2.) we would need to have some heuristic to figure out when and where to use I personally think we could live with those problems. Can anyone think of other issues? Issues with
|
@3jr When you say you're inserting the string How do you handle ordering the tags? In your example above, if I document Your name for the fixer/location for the source seem fine. For the string, maybe something like "Add XML documentation for parameter {0}"? Other than those things, your approach sounds good. Let us know when you have a PR we can look at. Thanks! |
@rchande I don't edit the text directly. I believe I'm doing that correctly (At least it looks the same in the SyntaxTree). I was more describing how the end result looks like to the user. The correct ordering of tags (no matter the order they are fixed in) is what I (hope to) get for inserting next to an other documentation tag I found. I believe (hope) the ordering isn't a problem with this approach. What I have to look at again is how to fix all occurrences at once. Probably I look at this again. For some reason I don't get the behavior I expect, maybe there are merge conflicts or something. I could use some information about roslyns unit test stuff. I don't really understand how the |
@3jr Your sorting approach sounds okay. We'll be able to give you better feedback on that, and on the fix all occurences stuff, once you send out a PR. Our markup strings let you mark up spans and named spans. This lets you specify things like a cursor selection, etc. When we have tests that need to look at multiple types of spans, we start naming them. Is there a specific test harness you want more information about? The markup code itself lives here. There's some good documentation at the top of that file on how to use the markup. If you have more questions about fix all, @mavasani is probably a good person to talk to. |
@3jr You can look at some sample FixAll unit tests here. Note that the default BatchFixer does some very basic merge conflict resolution when you have conflicting fixes being batched - it behaves well when your individual code fixes are edits or removals, but has been found to have issues when they are adds - which seems to be the case here. You have couple of options:
|
Note -- this issue is essentially a dupe of #7070. |
I am working on this as an extension of #7070. I hope to make a PR within a few days. |
@Hosch250 how far are you with this. I have some working code and I think I post it to #10520 (to see if the checks are successful). So you could use that as a starting point if you want to. My solution only works for:
I never meant to stall development for this; I apologize. I just started working on it because I thought I had a good idea how to tackle it. I was very unsure how to use the test facilities properly. Maybe I take a look at you PR and improve it a bit. |
The only thing left is to make it place the parameter in the correct order in the list. I don't support VB.NET yet, but I designed with this in mind, so it will be extremely simple to add support for it. If you wish, I can help you learn how to do these correctly--I needed a lot of help the first time I did it too. |
Also, if you decide to go through with it, you should definitely take a look at where I put my merged ones so everything is in the same folders. |
I'm looking forward to your implementation. I always wondered how I could implement this differently. |
I'll tag you when I create the PR so you can help review it. |
This issue was closed back in #12997 |
Oh, thanks for pointing that out! |
It'd be great if we had a quick fix for this warning:
The text was updated successfully, but these errors were encountered: