Skip to content

Using the Framework with Visual Studio Code

Sammi Husky edited this page Oct 22, 2019 · 6 revisions

Visual Studio Code

Visual Studio Code is a very lightweight and useful IDE (text editor) for programming offered by Microsoft. It offers many great features that help us in our daily lives as programmers. If you are new to programming or C/C++, VS Code will make using the framework much less of a headache for you.

Setting Everything Up

  1. First, download and install VS Code. If you already have it, skip this step. Once that is done installing you will also need the C/C++ Extension for intellisense and code completion, which we will configure in the next steps.

  2. For the rest of the setup, you will need to have created the skeleton project for your plugin OR the code-mod-example downloaded. Whatever you choose to do, open the folder in VS Code before continuing

  3. Press Ctrl + shift + p top open the command palette, then type C/C++: Edit Configurations (JSON). You can also edit the configuration via the UI if that's more your style, but you wont be able to change the configuration name.

  4. Replace everything in the file with the code from the template below. You will need to change /path/to/devkitpro to your actual installation directory. On Windows, this defaults to C:/devkitPro. For Linux, it's usually /opt/devkitpro.

  5. You're done! There is still more that can be set up, such as setting up build tasks for make and clean, but that isn't strictly necessary for writing plugins and we will cover that in a separate section. For now, VS Code has a built in command line that you can use to make and clean so you don't need a CLI separate window open

{
    "configurations": [
        {
            "name": "SaltySD Plugin",
            "includePath": [
                "${workspaceFolder}/code-mod-framework/framework/include/**",
                "${workspaceFolder}/code-mod-framework/lib/libnx_min/nx/**",
                "/path/to/devkitPro/devkitA64/aarch64-none-elf/include/**",
                "/path/to/devkitPro/devkitA64/lib/gcc/aarch64-none-elf/8.3.0/include/**",
                "/path/to/devkitPro/libnx/include/**"
            ],
            "defines": [
                "SWITCH",
                "__SWITCH__",
                "DEBUG"
            ],
            "compilerPath": "/path/to/devkitPro/devkitA64/bin/aarch64-none-elf-g++",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}