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

type hints for collection expressions #72250

Closed
ZacharyPatten opened this issue Feb 23, 2024 · 3 comments · Fixed by #74051
Closed

type hints for collection expressions #72250

ZacharyPatten opened this issue Feb 23, 2024 · 3 comments · Fixed by #74051
Assignees
Labels
Area-IDE Feature Request untriaged Issues and PRs which have not yet been triaged by a lead
Milestone

Comments

@ZacharyPatten
Copy link

Proposal

There should be a setting to enable type hints for collection expressions. If enabled, it would show types like the existing "Show hints for implicit object creation" setting in IDEs but for collection expressions:
image

Ideally, there should be a dedicated setting for collection expressions type hints:
image

note: edited screenshots are from Visual Studio 2022

Background and Motivation

Collection expressions were added in C# 12 along with IDE0028's automatic fix that encourages the use of collection expressions over previous construction syntax. However, collection expressions don't currently support type hints, so developers who prefer to see type hints have to keep using previous construction syntax and suppress or ignore IDE0028.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Issues and PRs which have not yet been triaged by a lead label Feb 23, 2024
@MisinformedDNA
Copy link

Is this still valid? While the option in VS isn't there (or is elsewhere), there are code fixers now.

@CyrusNajmabadi
Copy link
Member

@MisinformedDNA Yes, this suggestion is still valid. THis is about showing an inline-hint that tells you what the type of the collection expr is that is being created.

@dibarbet dibarbet removed the untriaged Issues and PRs which have not yet been triaged by a lead label Jun 17, 2024
@dibarbet dibarbet added this to the Backlog milestone Jun 17, 2024
@dibarbet dibarbet added the untriaged Issues and PRs which have not yet been triaged by a lead label Jun 17, 2024
@ZacharyPatten
Copy link
Author

@akhera99 🎉 thanks 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Feature Request untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants