xref: /aosp_15_r20/external/pigweed/pw_ide/guide/vscode/legacy.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1.. _module-pw_ide-guide-vscode-legacy:
2
3======================
4Legacy support via CLI
5======================
6.. pigweed-module-subpage::
7   :name: pw_ide
8
9The :ref:`pw_ide CLI<module-pw_ide-guide-cli>` provides an alternative method
10of configuring Visual Studio Code for :ref:`bootstrap Pigweed projects<module-pw_ide-design-projects-bootstrap>`
11that doesn't rely on the use of an extension. This page documents that
12functionality.
13
14.. tip::
15
16   Are you working on a :ref:`Bazel Pigweed project<module-pw_ide-design-projects-bazel>`?
17   These instructions won't work for you. Use the :ref:`extension<module-pw_ide-guide-vscode>`!
18
19-----
20Usage
21-----
22Running ``pw ide sync`` will automatically generate settings for Visual Studio
23Code. ``pw_ide`` comes with sensible defaults for Pigweed projects, but those
24can be augmented or overridden at the project level or the user level using
25``pw_project_settings.json`` and ``pw_user_settings.json`` respectively. The
26generated ``settings.json`` file is essentially a build artifact and shouldn't
27be committed to source control.
28
29.. note::
30
31   You should treat ``settings.json`` as a build artifact and avoid editing it
32   directly. However, if you do make changes to it, don't worry! The changes
33   will be preserved after running ``pw ide sync`` if they don't conflict with
34   with the settings that command sets.
35
36The same pattern applies to ``tasks.json``, which provides Visual Studio Code
37tasks for ``pw_ide`` commands. Access these by opening the command palette
38:kbd:`Ctrl+Shift+P` (:kbd:`Cmd+Shift+P` on Mac), selecting ``Tasks: Run Task``,
39then selecting the desired task.
40
41.. tip::
42
43   The default tasks that ``pw ide sync`` generates can serve as an example of
44   how to launch your own tasks within an activated environment.
45
46The same pattern also applies to ``launch.json``, which is used to define
47configurations for running and debugging your project. Create a
48``pw_project_launch.json`` with configurations that conform to the Visual Studio
49Code `debugger configuration format <https://code.visualstudio.com/docs/editor/debugging>`_.
50
51Commands
52========
53These commands are actually `tasks <https://code.visualstudio.com/docs/editor/tasks>`_,
54so you run them by running the ``Tasks: Run Task`` command, then selecting the
55task.
56
57.. describe:: Pigweed: Sync IDE
58
59   Runs ``pw ide sync`` without you needing to type it into an activated shell.
60
61.. describe:: Pigweed: Set C++ Target Toolchain
62
63   Allows you to select the target toolchain to use for code intelligence from
64   a dropdown list of available options.
65
66.. describe:: Pigweed: Set Python Virtual Environment
67
68   Allows you to provide the path to the Python virtual environment. This is
69   normally configured automatically to use the Pigweed environment's Python,
70   but for unusual project structures, you may need to select another Python
71   environment.
72