dotnet/roslyn

Auto-complete inserts closing brace causing auto-format to not be triggered

Ouverte

#32 211 ouverte le 7 janv. 2019

 (1 commentaire) (0 réaction) (0 personne assignée)C# (4 257 forks)batch import
Area-IDEBugDeveloper CommunityIDE-Formatterhelp wanted

Métriques du dépôt

Stars
 (20 414 étoiles)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

Description

This issue has been moved from https://developercommunity.visualstudio.com/content/idea/410260/improvement-to-code-editing-features.html VSTS ticketId: 752824 These are the original issue comments:

Jane Wu [MSFT] on 12/17/2018, 11:55 PM (20 days ago): Thank you for taking the time to provide your suggestion. We will do some preliminary checks to make sure we can proceed further. You will hear from us in about a week on our next steps. Kendra Havens [MSFT] on 1/3/2019, 02:50 PM (3 days ago): Thank you for the feedback! What gesture are you using to accept the auto-complete closing brace at the end of a block? Could you give an example? It may be a bug, auto-format should occur if auto-complete inserts the ending brace and you use the enter/return key. The "Automatically format on return" option should be checked in your Tools > Options > Text Editor > C# > Code Style > Formatting > General. Thank you for verifying. Using a different gesture like (Tab, Tab) will not auto-format the block.Instead of this, if you ever want to quickly Format Document the keyboard shortcut is (Ctrl + K, D).

Dan Franzblau on 1/5/2019, 00:18 PM (45 hours ago): Example: I type the following:for(int i=1; i<10; i++) {and VS completes the block to give me:for(int i=1; i<10; i++) { }with the caret (insertion point) between the braces. I then enter carriage return, and VS gives me:for(int i=1; i<10; i++) {}with the insertion point now on a line between the braces and the insertion point indented ready for a line of code in the block. Note, however that auto-format has not occurred in the for statement line. If I then delete and re-type the closing brace of the block, autoformatting will occur and I get:for (int i = 1; i < 10; i++) { }where "I=1;" has become "I = 1;", etc. Does this help explain the situation?Thank you.

Guide contributeur