mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-27 23:19:13 +08:00
f385e46927
* docs: split usage and dev docs * # This is a combination of 2 commits. # This is the 1st commit message: docs: split usage and dev docs # The commit message #2 will be skipped: # fixup add docs * docs: add runner documentation and move hooks documentation to devdocs * docs: add stubs for modules technical description * docs: add paragraph about event thread-safety * docs: add 'Current modules' section header
1.5 KiB
1.5 KiB
Coding Style
Philosophy
- If it's inserting something into the existing classes/functions, try to follow the existing style as closely as possible.
- If it's brand new code or refactoring a complete class or area of the code, please follow as Modern C++ of a style as you can and reference the C++ Core Guidelines as much as you possibly can.
Formatting
- We use
.clang-format
style file to enable automatic code formatting. You can easily format source files from Visual Studio. For example,CTRL+K CTRL+D
formats the current document. - If you prefer another text editor or have ClangFormat disabled in Visual Studio, you could invoke
format_sources
powershell script from command line. It gets a list of all currently modified files fromgit
and invokes clang-format on them. Please note that you should also haveclang-format.exe
in%PATH%
for it to work. The script can infer the path ofclang-format.exe
version which is shipped with Visual Studio at%VCINSTALLDIR%\Tools\Llvm\bin\
, if you launch it from the Native Tools Command Prompt for VS. - CI doesn't enforce code formatting yet, since we're gradually applying code formatting to the codebase, but please adhere to our formatting style for any new code.