This diff adds support for an alternate formatting style and auto-format on open. The intent is to make it easy to use a personal formatting style while working under a team-standard .clang-format.
New Format Options
- Style (Alternate): specifies an alternate formatting style.
Either Style can be specified as file:<path_to_clang-format>, which will select a formatting config file explicitly.
New Format On... Options
- Format On Open (Alternative): if true, the alternate style will be applied on file open. Note that the document dirty flag is forced clean when this happens, which can result in the in-editor version differing from the version saved to disk. Externally modified files will require a manual reinvokation when reloaded, for example.
- Format On Save: will re-run Format On Open (Alternative) after the save if it is set to true.
- Path Filter: a regex tested against the full file path to further refine which files are auto-formatted.
New menu commands
- Format Selection (Alternate): format the selection using Style (Alternate)
- Format Document (Alternate): format the current document using Style (Alternate)
- Format Open Documents: format currently opened documents using Style
- Format Open Documents (Alternate): format currently opened documents using Style (Alternate)
This examples allows you to view a personally preferred style in the editor while working under a
company-imposed formatting standard set by the repository-local .clang-format file:
Under Format On...:
- Format On Open (Alternate): True
- Format On Save: True
Under Format Options:
- Style: file
- Style (Alternate): file:c:\Users\me\my-format.clang-format