Dev:Visual Studio Code: Difference between revisions
Lunarsoap5 (talk | contribs) (Created page with "We '''strongly recommend''' using [https://code.visualstudio.com VS Code] as it is a lightweight, modern, cross-platform & open source Editor with a variety of plugins. Our Coding Guidelines were designed to work with VSCode in the following configuration, of course this is just an example and doesn't have to be identical to your setup; there's room for personal preferences as long as the core functions remain intact. ===Plugins=== ====C/C++...") |
Lunarsoap5 (talk | contribs) No edit summary |
||
Line 28: | Line 28: | ||
"includePath": [ | "includePath": [ | ||
"${workspaceFolder}/GameCube/externals/libtp_rel/include/", | "${workspaceFolder}/GameCube/externals/libtp_rel/include/", | ||
"${workspaceFolder}/GameCube/include/" | "${workspaceFolder}/GameCube/include/", | ||
"${workspaceFolder}/GameCube/subrel/boot/include", | |||
"${workspaceFolder}/GameCube/subrel/seed/include" | |||
], | ], | ||
"defines": [ | "defines": [ | ||
Line 37: | Line 39: | ||
], | ], | ||
"compilerPath": "C:/devkitPro/devkitPPC/bin/powerpc-eabi-g++.exe", | "compilerPath": "C:/devkitPro/devkitPPC/bin/powerpc-eabi-g++.exe", | ||
"cStandard": " | "cStandard": "c23", | ||
"cppStandard": "c++ | "cppStandard": "c++23", | ||
"intelliSenseMode": "gcc-x86", | "intelliSenseMode": "gcc-x86", | ||
"browse": { | "browse": { |
Revision as of 14:34, 24 March 2024
We strongly recommend using VS Code as it is a lightweight, modern, cross-platform & open source Editor with a variety of plugins.
Our Coding Guidelines were designed to work with VSCode in the following configuration, of course this is just an example and doesn't have to be identical to your setup; there's room for personal preferences as long as the core functions remain intact.
Plugins
C/C++ Tools
This plugin is a powerful tool that helps us to find mistakes in our code before even attempting to build, furthermore does it support formatting with our .clang-format configuation file from our Guidelines.
Setup:
- In VSCode hit Ctrl+Shift+X
- Search for "ms-vscode.cpptools"
- Click install
- Go to your main Settings by pressing Ctrl+,
- Search for "Default formatter" and select "ms-vscode.cpptools"
- Expand the "Extensions" and then "C/C++" menu
- Set the "Clang_format_fallback Style" to "Chromium"
- And "Clang_format_style" to "file"
- Leave other clang related settings default since most of them override the .clang-format configuration!
- Open a source file and you should find a "Win32" at the bottom right, click that and select "Edit Configurations (JSON)"
Replace your configuration with the following (or simply add the object with name "GC" to your existing "configurations" array):<syntaxhighlight lang="json"> {
"configurations": [ { "name": "GC", "includePath": [ "${workspaceFolder}/GameCube/externals/libtp_rel/include/", "${workspaceFolder}/GameCube/include/", "${workspaceFolder}/GameCube/subrel/boot/include", "${workspaceFolder}/GameCube/subrel/seed/include" ], "defines": [ "_BUILDID=\"YYYYMMDDHHmm\"", "_PROJECT_NAME=\"CHECK-MAKEFILE\"", "_VERSION=\"x.y.z\"", "_VARIANT=\"MKFILE\"" ], "compilerPath": "C:/devkitPro/devkitPPC/bin/powerpc-eabi-g++.exe", "cStandard": "c23", "cppStandard": "c++23", "intelliSenseMode": "gcc-x86", "browse": { "limitSymbolsToIncludedHeaders": true }, "compilerArgs": [] } ], "version": 4
} </syntaxhighlight>
- In the above configuration, you may need to change the value of "compilerPath" if your dekitPro is in a different location.
- If you would prefer to use the "GameCube" directory as your root in VSCode rather than its parent directory, you will also need to remove "GameCube" from the "includePath" values.
I encourage you to check the main settings menu and adjust some of the formatter specific settings to your liking. We have configured VSCode to use cpp-tools as its formatter, but we have not specified when it should be triggered. I have VSCode set up to format on save, paste, and when using <Shift+Alt+F> (the default key mapping).