Skip to content

Conversation

@baronfel
Copy link
Member

@baronfel baronfel commented Apr 1, 2022

This is a rebase and re-slice of the work @cartermp did in #10295, with two aims:

  • to update the code to the changes in the idioms of the compiler since then, and
  • to separate the feature into two PRs: one (this one) for the FCS changes, and another (here) for the Visual Studio changes.

The idea being that we can consume the FCS changes in FSAC and other editors while waiting for the VS effort to finish hooking up settings/UI/etc.

Note the following behavior:

  • Type hints are at definition/binding, not use
  • Type hints do not show if something already has an annotation
  • Parameter name hints appear for F# functions and methods, using the named argument syntax
  • Named parameters get no hints
  • Lambdas that are let-bound will have a type hint, but other let-bound F# functions will not

Out of scope:

  • Type hints for "normal" function declarations.
    • It just looks bad and there isn't a good way to play hints without getting smushed together with the type hint for the last parameter.
    • Lambda function declarations, yes.
  • Show inferred types for _ in a pattern
    • Note - this can be done orthogonally and also support quickinfo
  • Add QuickInfo -
    • Note, this can be done orthogonally.
    • We need a way to resolve the symbol we're showing the type for and get quickinfo from
    • No such API exists in the compiler today

Note the following behavior:

* Type hints are at definition/binding, not use
* Type hints do not show if something already has an annotation
* Parameter name hints appear for F# functions and methods, using the named argument syntax
* Named parameters get no hints
* Lambdas that are let-bound will have a type hint, but other let-bound F# functions will not

Out of scope:

* Type hints for "normal" function declarations.
  * It just looks bad and there isn't a good way to play hints without getting smushed together with the type hint for the last parameter.
  * Lambda function declarations, yes.
* Show inferred types for _ in a pattern
  * Note - this can be done orthogonally and also support quickinfo
* Add QuickInfo -
  * Note, this can be done orthogonally.
  * We need a way to resolve the symbol we're showing the type for and get quickinfo from
  * No such API exists in the compiler today
Copy link
Contributor

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks mate, and thanks @cartermp

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My approval does nothing, but the code looks wonderful. Best code I've ever seen, honestly.

😄

@vzarytovskii vzarytovskii merged commit d1cd836 into dotnet:main Apr 5, 2022
charlesroddie pushed a commit to charlesroddie/fsharp that referenced this pull request May 2, 2023
Note the following behavior:

* Type hints are at definition/binding, not use
* Type hints do not show if something already has an annotation
* Parameter name hints appear for F# functions and methods, using the named argument syntax
* Named parameters get no hints
* Lambdas that are let-bound will have a type hint, but other let-bound F# functions will not

Out of scope:

* Type hints for "normal" function declarations.
  * It just looks bad and there isn't a good way to play hints without getting smushed together with the type hint for the last parameter.
  * Lambda function declarations, yes.
* Show inferred types for _ in a pattern
  * Note - this can be done orthogonally and also support quickinfo
* Add QuickInfo -
  * Note, this can be done orthogonally.
  * We need a way to resolve the symbol we're showing the type for and get quickinfo from
  * No such API exists in the compiler today
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants