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

Tracking: F# Hints #14157

Open
psfinaki opened this issue Oct 21, 2022 · 11 comments
Open

Tracking: F# Hints #14157

psfinaki opened this issue Oct 21, 2022 · 11 comments
Labels
Area-LangService-Hints F# hints inspired by C# inline hints
Milestone

Comments

@psfinaki
Copy link
Member

psfinaki commented Oct 21, 2022

Note
This is a "meta" issue for tracking purposes since GitHub does not support special types of issues.

Supersedes #10289.

We'll be introducing a feature called F# hints. It is inspired by C# inline hints but will do more! The feature is going to be built on top of the dedicated Roslyn API.

This will supersede the experimental CodeLens feature that is current present in Visual Studio. The CodeLens brand in F# is planned to do the same as in other languages, i.e. show references, test coverage and so on (details here).

The plan is to gradually add different hints and make them configurable. Here is the proposed roadmap:

Bugs:

@psfinaki psfinaki added the Area-LangService-Hints F# hints inspired by C# inline hints label Oct 21, 2022
@psfinaki psfinaki added this to the October-2022 milestone Oct 21, 2022
@psfinaki psfinaki self-assigned this Oct 21, 2022
@psfinaki psfinaki moved this to Not Planned in F# Compiler and Tooling Oct 21, 2022
@github-actions github-actions bot modified the milestones: October-2022, Backlog Oct 21, 2022
@psfinaki psfinaki moved this from Not Planned to Planned in F# Compiler and Tooling Oct 21, 2022
@psfinaki psfinaki moved this from Planned to In Progress in F# Compiler and Tooling Oct 21, 2022
@vzarytovskii vzarytovskii changed the title Tracking: F# Hints Tracking: F# Hints Oct 21, 2022
@kerams
Copy link
Contributor

kerams commented Nov 7, 2022

Can hints themselves have tooltips? This here looks like an empty one:

image

It would be nice to reuse type annotation tooltips with all the good stuff like clickable references:

image

(Sorry if this is not the place for a Hints discussion)

Looks like a function needs to be passed in
https://github.com/dotnet/roslyn/blob/315c2e149ba7889b0937d872274c33fcbfe9af5f/src/Tools/ExternalAccess/FSharp/InlineHints/FSharpInlineHint.cs

Also I've noticed that GetInlineHintsAsync is invoked twice after one keystroke. Is it a Roslyn thing?

@vzarytovskii
Copy link
Member

I think it's a great idea, we should make hints interactive if we can.

@psfinaki
Copy link
Member Author

psfinaki commented Nov 8, 2022

Sorry if this is not the place for a Hints discussion

This IS a place for hints discussion :)

Can hints themselves have tooltips?

I think so. As long the information doesn't aggressively jump on the user, it's only helpful.

Also I've noticed that GetInlineHintsAsync is invoked twice after one keystroke. Is it a Roslyn thing?

On the one hand, it sounds suspicious, on the other hand, I don't have an idea what in our code can trigger this, we have a very thin layer now. I will investigate.

@majocha
Copy link
Contributor

majocha commented Mar 26, 2023

This is probably bug on Roslyn side, but hints won't go away when you release Alt+F1, unlike in C# editor.

@vzarytovskii
Copy link
Member

This is probably bug on Roslyn side, but hints won't go away when you release Alt+F1, unlike in C# editor.

No, it's not implemented yet. Tracked in #14260

@raymens
Copy link

raymens commented Jul 11, 2023

It would be nice if a Numerics.BigInteger would be shown as bigint instead.
Not sure if there are any other similar types.
Is there already some sort of mapper to simplify names? In that case I could maybe have a go at it.

image

@psfinaki
Copy link
Member Author

@raymens so, that's an interesting thing and it also applies to the tooltips. You get the full type name there unless you have specified in the opens. Take a look:

fulltypes.mp4

This somewhat makes sense to me. Also this means that probably in many cases you'd have the short types there. WDYT?


That said, the tooltips for the hints themselves show the short type anyway:

image

This is inconsistent and worth fixing.


Now, as for the mechanics of that, I think this is not a big deal and basically just depends on what info you take from the symbol:
image

@kerams
Copy link
Contributor

kerams commented Jul 12, 2023

I think his point is that BigInteger should behave like Int32 does, where we don't use the .NET name but the F# one.

According to https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/basic-types, bigint is an abbreviation, but the type itself does not count as a basic F# type.

@psfinaki
Copy link
Member Author

Oh, that thing. Well so the docs above pretty much answers the question :)

I am on a fence then. We can technically hardcode this conversion in the code but, given that this seems to be the only thing of that nature - and it's not very common I guess - not sure if it's worth it.

@raymens
Copy link

raymens commented Jul 14, 2023

Thanks for the detailed explanation.
I was indeed mostly referring to the (to us highly used) bigint abbreviation.

Maybe the solution is to consider bigint a basic type instead... considering it's the only one apparently. However I'm going off-topic and there's probably reasons why that's the case.

@psfinaki
Copy link
Member Author

Well, that's because it's arguably not that basic :)

I think, yeah, just mapping this type to its short form would be sufficient. I would be up for having it. Feel free to jump on this, or we can create a ticket and someone will eventually pick it up.

@psfinaki psfinaki moved this from In Progress to Planned in F# Compiler and Tooling Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-Hints F# hints inspired by C# inline hints
Projects
None yet
Development

No branches or pull requests

6 participants