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

Suggestion: Auto-generate record fields when creating a record value #3748

Open
Tracked by #15408
cmeeren opened this issue Oct 13, 2017 · 5 comments
Open
Tracked by #15408

Suggestion: Auto-generate record fields when creating a record value #3748

cmeeren opened this issue Oct 13, 2017 · 5 comments
Labels
Area-LangService-CodeFixes Code fixes associated with diagnostics Feature Request
Milestone

Comments

@cmeeren
Copy link
Contributor

cmeeren commented Oct 13, 2017

It would be great if the IDE could generate record field labels when you create a record value.

Given this type:

type MyType =
  {Field1: string
   Field2: int
   Field3: bool}

When I write:

let value = 
  {Field1 =<caret here>

I want to be able to execute a quick action or similar so that I end up with the following:

let value = 
  {Field1 =<caret here>
   Field2 = 
   Field3 = }

I realize of course that this might assume one particular style of writing structs, which complicates this a bit.

On the topmost level, what I want is to not have to remember (or look up the definition) and manually type all field names all the time (nor do I want to type those I remember and wait for the IDE to tell me the rest when static analysis fails).

@isaacabraham
Copy link
Contributor

In terms of UI experience, this is something offered in both VFPT and in Ionide so we could use them both as a starting point. VFPT offers some configuration options for what to put on the RHS.

@realvictorprm
Copy link
Contributor

realvictorprm commented Oct 13, 2017 via email

@cmeeren
Copy link
Contributor Author

cmeeren commented Oct 13, 2017

Three of my colleagues would also certainly love this.

@realvictorprm
Copy link
Contributor

realvictorprm commented Oct 13, 2017 via email

@kerams
Copy link
Contributor

kerams commented Apr 15, 2022

What about ambiguities caused by records with common field names? Can quick action/code fix menus have multiple levels, allowing you to choose the right type? I think I've seen that kind of thing in C#.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-CodeFixes Code fixes associated with diagnostics Feature Request
Projects
Archived in project
Development

No branches or pull requests

8 participants