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

Discussion: Overriding with expression bodies #8380

Closed
miloush opened this issue Feb 4, 2016 · 4 comments
Closed

Discussion: Overriding with expression bodies #8380

miloush opened this issue Feb 4, 2016 · 4 comments
Assignees
Labels
Area-IDE Feature Request Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@miloush
Copy link

miloush commented Feb 4, 2016

Hi,

I am in the process of overriding couple of read-only properties that I would like to implement using simple expression bodies. However the autocomplete is pushing me hard into full bodies - I basically need to declare the property by typing each letter, dismissing any attempts to help. I wonder whether anything could be done in this regard?

I am not really sure what though... One obvious idea is to have a setting to use expression bodies whenever applicable when generating code, but I am not that big fan of that.

Another idea I had was the similar experience we had when adding handlers to the events - if possible, you will get an expression body implementation with a tooltip saying hit TAB (or enter for that matter) to get a full body instead. The problem with this one is that apparently throwing an exception is not a valid thing in an expression body, so the default implementation must be real. It could default to default(type) which would be selected like when generating event handlers, so that you can start typing over it. Since expression bodies are meant to by easy and short, that shouldn't be that much of issue.

What do others think?

@DustinCampbell
Copy link
Member

Great suggestion! WRT to the first bit, I think we want a cohesive experience around expression-bodied members, including code style options to generate them by default and refactorings to convert back and forth (a la C# Essentials).

@DustinCampbell DustinCampbell modified the milestones: 2.0 (RC), 2.0 (Preview) Mar 9, 2016
@Pilchie Pilchie removed this from the 2.0 (Preview 5) milestone Sep 16, 2016
@Pilchie Pilchie added this to the 2.1 milestone Sep 22, 2016
@Pilchie Pilchie modified the milestones: 15.1, 15.3 Mar 29, 2017
@Pilchie
Copy link
Member

Pilchie commented Mar 29, 2017

@CyrusNajmabadi @rchande - does override completion now listen to the option?

@rchande
Copy link
Contributor

rchande commented Mar 29, 2017

Yes, it should respect these options:
image

@Pilchie
Copy link
Member

Pilchie commented Apr 10, 2017

Closing as fixed.

@Pilchie Pilchie closed this as completed Apr 10, 2017
@Pilchie Pilchie added the Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented label Apr 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Feature Request Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

No branches or pull requests

5 participants