Visual Studio Code setup

Extensions

I installed the following extensions:

  • ms-vscode.cpptools: It's the Microsoft extension for C++ code completion and debugging. I use this extension for the peek and go to definition features. Other elements are deactivated in user settings.
  • hars.CppSnippets: It offers some useful code snippets.
  • mitaki28.vscode-clang: The best Clang extension around. A must-have
  • twxs.cmake: Great extension for assisting you in creating CMake files.
  • vector-of-bool.cmake-tools: Optional, but also recommended
  • xaver.clang-format: The best and complete clang-format assistant you can have (at the time of writing it is more feature-rich than the Microsoft one)

I tweaked the setup in Visual Studio Code in the User Settings. Now this is up for debate if you prefer storing these settings at user level or at workspace level. Workspace settings are stored in the workspace, which wil be the root folder of the git repository. This offers you the opportunity to sync these with git and have other collaborators, using Visual Studio Code aswell, to use the same settings.

User or Workspace settings can be accessed like so:

File > Preferences > User Settings
or
File > Preferences > Workspace Settings

Because cpptools also has the clang_format option, I chose to disable it, by disabling the style options. The editor.formatOnSave is required for the Clang-format extension to work.

{
    "clang.executable": "/usr/bin/clang",
    "clang-format.executable": "/usr/bin/clang-format",
    "editor.formatOnSave": true,
    "C_Cpp.autocomplete": "Disabled",
    "C_Cpp.clang_format_path": "/usr/bin/clang-format",
    "C_Cpp.clang_format_style": "none",
    "C_Cpp.clang_format_fallbackStyle": "none"
}

The settings screen looks as follows:

Setting up the workspace

Visual Studio Code is very easy when it comes to workspaces. Basically it's just a folder. So in the file menu you can choose to open an existing folder or create a new one.

File > Open Folder

That's it! Workspace settings will be stored in a subdirectory of this opened folder called:

.vscode

Once Git is installed, you can init the workspace as a repository:

results matching ""

    No results matching ""