-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
formatOnType only works with semicolon for clang-format #1419
Comments
Format on type only works for ";" -- which isn't particularly useful. Ideally we would add support for additional characters like "(", "{", ")", "}" (not really sure which). The trigger characters are set in the extension process. I'm not sure if we already have an issue tracking that. I could mark this as a feature request if you want. |
Formatting when pressing Enter would be good too. |
Adding formatting on Enter is problematic with our given implementation using clang-format. The problem is that you often want to use Enter to add whitespace, but then formatting gets run on Enter and deletes the whitespace. |
If the user hits enter, I think it would make more sense to format the last line that they were on, not the new line that is created, since that line will usually be blank. If it is not blank then format both lines. |
I wrote an extension to format modified lines, but there's actually a bug in clang-format which means that you can't actually format a single line. If you specified a range of characters within a line, or a line range of only one line, it insists on formatting the line and the next one. 8-( |
@kylegmaxwell for your second request, does |
@bobbrow Unfortunately not. I tried that and it updated the whole file. I am working on a large code base where that is undesirable when I make a small change to a file. I am happy to file a separate feature request if that would be helpful. |
@kylegmaxwell you might want to file that request with the VS Code team. Our extension could potentially roll out an implementation for it, but it would be great if all languages could take advantage of it. |
EDIT: moved to #5962 |
@escape0707 I moved your comment to a new issue. |
@escape0707 The formatOnType issue has been fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/0.30.0-insiders3 . |
This feature request has received enough votes to be added to our backlog. |
"editor.formatOnType: true" doesn't seem to work for me. I did a bit of digging and I couldn't find anywhere that sets the firstTriggerCharacter or moreTriggerCharacter to anything specific, so I was wondering if it's implemented?
The text was updated successfully, but these errors were encountered: