Don't show empty parameter XML Doc in signature helper and correctly compute argument index#1895
Don't show empty parameter XML Doc in signature helper and correctly compute argument index#1895KevinRansom merged 6 commits intodotnet:masterfrom cartermp:temp-xml-doc-fix
Conversation
|
Looks like In short, I think it's buggy. |
|
Yeah, there's a -1 on the argument index which may be going awry. It's there for.the case where "(" is the start of a zero-argument list "()". We can report the argument index in the package of data handed off to unit testing. |
| for method in methods do | ||
| // Create the documentation. Note, do this on the background thread, since doing it in the documentationBuild fails to build the XML index | ||
| let methodDocs = XmlDocumentation.BuildMethodOverloadTipText(documentationBuilder, method.Description, true) | ||
| let methodDocs = XmlDocumentation.BuildMethodOverloadTipText(documentationBuilder, method.Description, false) |
There was a problem hiding this comment.
I believe we still want true here
-
with "true" the active parameter is shown underneath the list of all parameters. The active parameter is shown in bold. There is duplication.
-
with "false", only one the active parameter is shown, no others
The duplication is unfortunate and seems a Roslyn proble? But I think we definitely want all parameters - more information is better than less here.
There was a problem hiding this comment.
I guess I should clarify - I believe that the right behavior here is the one that C# does (and that this PR does as well). Showing all parameters could be too much on the eyes for any method with more than 3 parameters. I don't have data proving this, but I believe that there are enough cases out there that justify this.
It's tricky. We've shown all the parameters for a long time, so I'm used to it. Also (and I think crucially), VIsual F# just doesn't have the same full set of navigational/library-lookup mechanisms as C#, so this is the only way an F# user gets information, short of looking up the docs. We went around a similar loop with QuickInfo displays for VF# 2.0. F# shows much more info than C#. We thought about changing to C#'s version, but soon discovered that you could just no longer find out anything from F#. So my gut feeling is that we should show at least what we showed in VS2008-15, which is all the parameters. Showing less is prettier, but leaves the user in a very awkward place if they want to get more information. At the moment even F1 help to go to MSDN is not wired up. |
|
@dsyme Okay, How about I revert the call the I think that the current behavior (hovering over something only provides the summary, invoking that QuickInfo item with |
|
ok |
|
@dsyme I think I figured out the argument index problem. It works as expected for all of these. Deleting and re-adding a comma or open paren also works: type Foo() =
/// <summary>
/// Does even more stuff.
/// </summary>
member this.DoAnotherThing(aString, anInt, aFloat) =
sprintf "The string is: %s, and the int is: %d, and the float is: %f" aString anInt aFloat
/// <summary>
/// Does other stuff with lots of parameters. It really is a lot of stuff and this is a fairly long summary comment.
/// </summary>
/// <param name="aString">This is the string which gets passed into this method. This is kind of a long param comment, but not uncommon.</param>
/// <param name="anInt">This is the integer which gets passed into this method. This is kind of a long param comment, but not uncommon.</param>
/// <param name="aFloat">This is the floating-point value which gets passed into this method. This is kind of a long param comment, but not uncommon.</param>
/// <param name="anArray">This is the array which gets passed into this method. This is kind of a long param comment, but not uncommon.</param>
/// <exception cref="System.Exception">Thrown when the exception is thrown.</exception>
/// <exception cref="System.ArgumentException">Thrown when the exception is thrown.</exception>
/// <exception cref="System.ArgumentNullException">Thrown when the exception is thrown.</exception>
/// <exception cref="System.Aggregate">Thrown when the exception is thrown.</exception>
member this.HasManyParameters(aString, anInt, aFloat, anArray: 'a[]) =
sprintf "The string is: %s, and the int is: %d, and the float is: %f, and the array is: %A" aString anInt aFloat anArray
/// <summary>
/// Does some stuff.
/// </summary>
member this.DoStuff(aString, anInt) =
sprintf "The string is: %s, and the int is: %d" aString anInt
/// <summary>
/// Does other stuff.
/// </summary>
/// <param name="aString">A string!</param>
/// <param name="anInt">An int!</param>
member this.DoOtherStuff(aString, anInt) =
sprintf "The string is: %s, and the int is: %d" aString anInt |
|
It looks like the unit tests need updating If you need to, follow the instructions at the top of the Signature Help test file to run the tests in F# Interactive and dump the update expected results. |
|
Fix looks good otherwise!! |
|
Ah! I'll update that test (and perhaps add a few more test cases). |
|
@cartermp Great! :) |
|
I modified the first test case a bit and added another expected clause. The rest were just adjustments to the expected span which comes back from |
|
Close/reopen to run tests again |
|
@cartermp does this PR fix the following duplication? |
|
@vasily-kirichenko Technically yes, but it's still not that great of a solution. The best we can do is to change this line to pass in Alternatively, we would request a Roslyn feature to understand the way that we currently display all parameters, and highlight the active one based on that. I think it's very unlikely that such a change would be accepted at this time. |
|
We should remove the duplicated line and fix f1 and f12 to allow us to show the additional information. Kevin |
|
@cartermp can you prepare a PR to just remove the redundent line. I will pull this as is. |
…compute argument index (dotnet#1895) * Show 'no documentation' as QuickInfo workaround when no XML doc comments are defined * Don't add newline if there aren't parameter docs * Don't ask BuildMethodOverloadTipText to also handle parameters * Show all parameters when invoking signature helper * Account for edge case when computing argument index. * Adjust tests


Fixes #1893:
However, there is also another bug - only the first parameter is shown when typing another parameter:
This is the same behavior in master:
I can take a look, but meanwhile this does address the issue of showing empty parameter XML doc comments.