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

foreach autocompletion should be offered when ctrl+. is pressed on a variable representing a collection #60628

Closed
Tracked by #56541
vsfeedback opened this issue Apr 7, 2022 · 2 comments · Fixed by #67819
Labels
Area-IDE Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Feature Request help wanted The issue is "up for grabs" - add a comment if you are interested in working on it IDE-CodeStyle Built-in analyzers, fixes, and refactorings
Milestone

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


There are several things that happen over and over again in programming. One of them is implementing foreach loops for variables.

Consider the following:

string[] names = new string[] {"John", "Peter", "Dan"};
names // press CTRL+. on `names` variable

at this point I would love to have an option in the context menu that would implement:

string[] names = new string[] {"John", "Peter", "Dan"};
foreach (string name in names) {
   // caret here
}

PS: I know I can write foreach and press tabulator twice and it helps but it still requires quite a lot of manual work to get it to required code.

Thank you for considering this feature.


Original Comments

Feedback Bot on 3/21/2022, 07:33 AM:

(private comment, text removed)

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 7, 2022
@jmarolf
Copy link
Contributor

jmarolf commented Apr 7, 2022

related to #56541

@jinujoseph jinujoseph added Feature Request Developer Community The issue was originally reported on https://developercommunity.visualstudio.com and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 19, 2022
@jinujoseph jinujoseph added this to the Backlog milestone Apr 19, 2022
@jinujoseph jinujoseph added Need Design Review The end user experience design needs to be reviewed and approved. IDE-CodeStyle Built-in analyzers, fixes, and refactorings labels Apr 19, 2022
@CyrusNajmabadi
Copy link
Member

Design meeting review 4/25/2022.

  1. We are highly in favor of improving the experiences here.
  2. There are two closely related avenues that we want to improve the experience here with.
  3. First, we think 'semantic snippets' will be a great way for people to discover powerful snippets when they start typing a statement/expression.
  4. Second, we think postfix-completion would be highly useful here as well. We already have such a feature for await where you can type .await (or awaitf) and have a complex change happen that can be very useful. We think expanding on that for things like .for .foreach .null etc. etc. would be great. The benefit of postfix-completion is that it can then use information about what is being completed off of to filter down to only relevant completions.

We also discussed if this should be in the space of intellicode/prose. Our feelings were that this is more appropriate for us to do so that users can have confidence that these features are always available and work in a deterministic fashion every time they try to use them.

@CyrusNajmabadi CyrusNajmabadi removed their assignment Apr 25, 2022
@CyrusNajmabadi CyrusNajmabadi added help wanted The issue is "up for grabs" - add a comment if you are interested in working on it and removed Need Design Review The end user experience design needs to be reviewed and approved. labels Apr 25, 2022
@jmarolf jmarolf mentioned this issue Apr 25, 2022
5 tasks
@sharwell sharwell moved this to Complete in IDE: Design review Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Developer Community The issue was originally reported on https://developercommunity.visualstudio.com Feature Request help wanted The issue is "up for grabs" - add a comment if you are interested in working on it IDE-CodeStyle Built-in analyzers, fixes, and refactorings
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants