-
Notifications
You must be signed in to change notification settings - Fork 34.9k
Closed
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalityformattingSource formatter issuesSource formatter issuesinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code Insiderson-testplan
Milestone
Description
Issue Type
Feature Request
Description
It would be helpful if there were a way to format only the modified lines. What is modified would be determined by source control. Currently formatOnType only works with semi colon (see microsoft/vscode-cpptools#1419), and formatOnSave formats the entire file. This is undesirable when working on large codebases with legacy code. In that case I want to make a small change, and have it automatically formatted on save, but not modify the rest of the file, which would create a huge diff.
It would also be great to have similar behavior for trimming trailing white space.
VS Code Info
VS Code version: Code 1.20.1 (f88bbf9, 2018-02-13T15:31:21.019Z)
OS version: Linux x64 4.14.16-200.fc26.x86_64
Steps to Reproduce:
- Set preferences:
"editor.formatOnSave": true,
"C_Cpp.clang_format_path": "/usr/bin/clang-format", - Open a C++ file with multiple formatting errors
- Modify the file on one line.
- Note that multiple modifications have been made to the file.
Does this issue occur when all extensions are disabled?:
No, formatting does not work at all in that case.
j4nu5, afmotta, BenjaVR, joe776, ozanorhan and 69 more
Metadata
Metadata
Assignees
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalityformattingSource formatter issuesSource formatter issuesinsiders-releasedPatch has been released in VS Code InsidersPatch has been released in VS Code Insiderson-testplan