ionide-vscode-fsharp icon indicating copy to clipboard operation
ionide-vscode-fsharp copied to clipboard

Use `cref` etc. information from XML documentation to generate links in tooltips and Info Panel

Open seanamos opened this issue 3 years ago • 9 comments

Describe the bug**

If something is documented with XML docs and they reference a generic type, the info tooltip displays these generic types incorrectly. It also breaks text following them.

It seems the backtick character ` is interpreted as markdown.

/// <summary>
/// Testing <see cref="T:Async`1" /> and some more text before <see cref="T:Async`1" />.
/// </summary>
let x = 1

Screenshots

Screenshot from 2021-06-23 22-27-11

There is sort of a workaround for the display issue that is compatible with FSharp.Formatting (haven't tested in VS/Rider).

/// <summary>
/// Testing ``<see cref="T:Async`1" />`` and some more text before ``<see cref="T:Async`1" />``.
/// </summary>
let x = 1

However, after doing this to a few XML docs, VSCode starts to heavily lag and eventually completely hangs. I've even seen VSCode bomb after doing this to one XML doc.

seanamos avatar Jun 23 '21 22:06 seanamos

Hey @seanamos :wave:,

Thank you for opening an issue. We will get back to you as soon as we can. Also, check out our OpenCollective and consider backing us.

https://opencollective.com/ionide

PS.: We offer backer support for all backers. Don't forget to add backer label when you start backing us :smile:

Hello, the problem you are encountering with the workaround is related to https://github.com/ionide/ionide-vscode-fsharp/issues/1073

There is probably something in FSAC that's causing this problem but we aren't able to find the reason...

About the problem of display it is coming from

https://github.com/fsharp/FsAutoComplete/blob/1e1f5e5338ecc69fb8103238d8fb44901d608dad/src/FsAutoComplete.Core/TipFormatter.fs#L81-L88

because we are just surrouding the extracted with ` so the code generates this markdown like that `Async`1`.

@baronfel @Krzysztof-Cieslak What should we display in case like these?

Should we display the non generic version Async or the generic version Async<_> ?

MangelMaxime avatar Jun 24 '21 07:06 MangelMaxime

Commenting here just to know what will happen.

64J0 avatar Aug 01 '21 00:08 64J0

We should have proper process of 'see' links to resolve them to their known members: in this case whatever generic parameter name Async is defined with is what we should render in the tooltip, ideally with a hyperlink to either go to that type or open the info panel on that type

baronfel avatar Aug 01 '21 01:08 baronfel

Generating an hyperlink should be doable now that https://github.com/microsoft/vscode-languageserver-node/issues/503 has been fixed.

The things, I don't know how to do is how to get the type information from the tips. Is their an example somewhere?

MangelMaxime avatar Aug 01 '21 11:08 MangelMaxime

We don't currently have a nice way to resolve a type from the name...it's kinda an open question in tooling I think. At least as of now we are properly escaping the XMLdocs for See xmldoc:

image image

baronfel avatar Nov 20 '21 20:11 baronfel

Very happy with that in the interim, big improvement over the previous formatting!

seanamos avatar Nov 20 '21 21:11 seanamos

I've renamed the issue to refocus it on including links - the issue with formatting was fixed a while ago.

Krzysztof-Cieslak avatar Jul 18 '22 22:07 Krzysztof-Cieslak

I tried several time to look into this issue but I just don't know how to do it.

In order to generate a showDocumentation command we need the assembly name. But how can we find the assembly name from just a type name?

Any ideas?

MangelMaxime avatar Aug 17 '22 08:08 MangelMaxime