doc, tools: Improve docs around using clang-format with VS (#9782)

* Improved the clarity of the extra step involving
generation of a clang-format.exe when using VisualStudio

* Added Get-Format function to OpenConsole.psm1 and
updated the documentation accordingly.

Closes #9777.
This commit is contained in:
Kayra Kaygın 2021-04-21 18:51:58 +03:00 committed by GitHub
parent 6b4f70e985
commit dfb48f45c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -9,7 +9,13 @@ git submodule update --init --recursive
OpenConsole.sln may be built from within Visual Studio or from the command-line using a set of convenience scripts & tools in the **/tools** directory:
When using Visual Studio, be sure to set up the path for code formatting. This can be done in Visual Studio by going to Tools > Options > Text Editor > C++ > Formatting and checking "Use custom clang-format.exe file" and choosing the clang-format.exe in the repository at /dep/llvm/clang-format.exe by clicking "browse" right under the check box.
When using Visual Studio, be sure to set up the path for code formatting. To download the required clang-format.exe file, follow one of the building instructions below and run:
```powershell
Import-Module .\tools\OpenConsole.psm1
Set-MsBuildDevEnvironment
Get-Format
```
After, go to Tools > Options > Text Editor > C++ > Formatting and checking "Use custom clang-format.exe file" in Visual Studio and choose the clang-format.exe in the repository at /packages/clang-format.win-x86.10.0.0/tools/clang-format.exe by clicking "browse" right under the check box.
### Building in PowerShell

View file

@ -430,4 +430,12 @@ function Invoke-CodeFormat() {
}
}
Export-ModuleMember -Function Set-MsbuildDevEnvironment,Invoke-OpenConsoleTests,Invoke-OpenConsoleBuild,Start-OpenConsole,Debug-OpenConsole,Invoke-CodeFormat,Invoke-XamlFormat,Verify-XamlFormat
#.SYNOPSIS
# Download clang-format.exe required for code formatting
function Get-Format()
{
$root = Find-OpenConsoleRoot
& "$root\dep\nuget\nuget.exe" restore "$root\tools\packages.config"
}
Export-ModuleMember -Function Set-MsbuildDevEnvironment,Invoke-OpenConsoleTests,Invoke-OpenConsoleBuild,Start-OpenConsole,Debug-OpenConsole,Invoke-CodeFormat,Invoke-XamlFormat,Verify-XamlFormat,Get-Format