Legacy support via CLI#

pw_ide: Code editor and IDE support for Pigweed projects

The pw_ide CLI provides an alternative method of configuring Visual Studio Code for bootstrap Pigweed projects that doesn’t rely on the use of an extension. This page documents that functionality.

Tip

Are you working on a Bazel Pigweed project? These instructions won’t work for you. Use the extension!

Usage#

Running pw ide sync will automatically generate settings for Visual Studio Code. pw_ide comes with sensible defaults for Pigweed projects, but those can be augmented or overridden at the project level or the user level using pw_project_settings.json and pw_user_settings.json respectively. The generated settings.json file is essentially a build artifact and shouldn’t be committed to source control.

Note

You should treat settings.json as a build artifact and avoid editing it directly. However, if you do make changes to it, don’t worry! The changes will be preserved after running pw ide sync if they don’t conflict with with the settings that command sets.

The same pattern applies to tasks.json, which provides Visual Studio Code tasks for pw_ide commands. Access these by opening the command palette Ctrl+Shift+P (Cmd+Shift+P on Mac), selecting Tasks: Run Task, then selecting the desired task.

Tip

The default tasks that pw ide sync generates can serve as an example of how to launch your own tasks within an activated environment.

The same pattern also applies to launch.json, which is used to define configurations for running and debugging your project. Create a pw_project_launch.json with configurations that conform to the Visual Studio Code debugger configuration format.

Commands#

These commands are actually tasks, so you run them by running the Tasks: Run Task command, then selecting the task.

Pigweed: Sync IDE

Runs pw ide sync without you needing to type it into an activated shell.

Pigweed: Set C++ Target Toolchain

Allows you to select the target toolchain to use for code intelligence from a dropdown list of available options.

Pigweed: Set Python Virtual Environment

Allows you to provide the path to the Python virtual environment. This is normally configured automatically to use the Pigweed environment’s Python, but for unusual project structures, you may need to select another Python environment.