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

Suggest pattern names for union case fields #15530

Merged
merged 13 commits into from
Jul 21, 2023
Merged

Conversation

kerams
Copy link
Contributor

@kerams kerams commented Jun 30, 2023

Implements #1885.

Names are suggested in match clause, binding and lambda patterns of arbitrary nesting. Functions and values also no longer clutter the completions, since they are not legal in patterns.

devenv_91FH5ln3yQ

devenv_TMRYBSLGLH

devenv_2fAM815XfA

The initial high priority of these suggested names does get lost as you start typing though, because VS sorts the list on its own.

@kerams kerams requested a review from a team as a code owner June 30, 2023 16:57
@auduchinok
Copy link
Member

Do the following cases still work with this change?

Some, None, Nested, U, A, Id, Num should all still be available:

module Nested =
    type U =
        | A

    let (|Id|) x = x

    let [<Literal>] Num = 1

open Nested

match None with
| Some({caret})

The same, but without the parens:

match None with
| Some {caret}

@kerams
Copy link
Contributor Author

kerams commented Jun 30, 2023

All of those items are present.

@auduchinok
Copy link
Member

Functions and values also no longer clutter the completions, since they are not legal in patterns.

All of those items are present.

It's interesting, given that Num is a value. 🙂

@vzarytovskii vzarytovskii enabled auto-merge (squash) July 21, 2023 10:40
@vzarytovskii vzarytovskii merged commit 218206f into dotnet:main Jul 21, 2023
@kerams kerams deleted the sug branch July 21, 2023 12:57
@kerams kerams changed the title Suggest identifier names in patterns Suggest pattern names for union case fields Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants