Visual Studio Code: Difference between revisions
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
* Debug > Install additional debuggers... > C++ | * Debug > Install additional debuggers... > C++ | ||
* Install the top two CMake packages (one for project mgmt, one for cmake file editing) | * Install the top two CMake packages (one for project mgmt, one for cmake file editing) | ||
=== Plugins === | |||
* C/C++, CMake, CMake Tools | |||
* Bookmarks; go F2, set ctrl-F2 | |||
* Numbered bookmarks; go c-1, set c-a-sh-1 | |||
* change-case | |||
=== Config and Key Bindings === | |||
Use the editor; changes are stored and shared across installs from here: | |||
ls ~/.config/Code/User/ | |||
keybindings.json -> ../../../development/config/common/home/m/.config/Code/User/keybindings.json | |||
settings.json -> ../../../development/config/common/home/m/.config/Code/User/settings.json | |||
=== Intellisense === | === Intellisense === | ||
Use CMake to generate json that includes the project headers, then import that into vscode settings, for a DRY way to set up header paths. | Use CMake to generate json that includes the project headers, then import that into vscode settings, for a DRY way to set up header paths. | ||
* Add this to CMakeList.txt to generate compile_commands.json: | * Add this to CMakeList.txt to generate compile_commands.json: |
Revision as of 13:24, 19 January 2019
Install
- Add the repo
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
- Update as usual
sudo apt-get update sudo apt-get install code # released monthly # or code-insiders (released daily) # use [apt search visualst]
- Debug > Install additional debuggers... > C++
- Install the top two CMake packages (one for project mgmt, one for cmake file editing)
Plugins
- C/C++, CMake, CMake Tools
- Bookmarks; go F2, set ctrl-F2
- Numbered bookmarks; go c-1, set c-a-sh-1
- change-case
Config and Key Bindings
Use the editor; changes are stored and shared across installs from here:
ls ~/.config/Code/User/ keybindings.json -> ../../../development/config/common/home/m/.config/Code/User/keybindings.json settings.json -> ../../../development/config/common/home/m/.config/Code/User/settings.json
Intellisense
Use CMake to generate json that includes the project headers, then import that into vscode settings, for a DRY way to set up header paths.
- Add this to CMakeList.txt to generate compile_commands.json:
# MDM This creates compile_commands.json, which can be imported by vscode to set include paths from here, w00t DRY set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
- Edit your project settings (eg...)
/home/m/development/thedigitalage/AbetterTrader/server/.vscode/c_cpp_properties.json
- Add a compileCommands directive:
{ "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/**" ], "defines": [], "compilerPath": "/usr/bin/clang", "cStandard": "c11", "cppStandard": "c++17", "intelliSenseMode": "clang-x64", "configurationProvider": "vector-of-bool.cmake-tools", "compileCommands": "${workspaceFolder}/cmake-debug/compile_commands.json" } ], "version": 4 }