xref: /aosp_15_r20/external/pigweed/pw_ide/guide/vscode/troubleshooting.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1.. _module-pw_ide-guide-vscode-troubleshooting:
2
3===============
4Troubleshooting
5===============
6.. pigweed-module-subpage::
7   :name: pw_ide
8
9This doc provides troubleshooting advice specific to the Pigweed Visual Studio
10Code extension.
11
12.. _project-type:
13
14----------------------------
15Can't determine project type
16----------------------------
17The Pigweed extension wasn't able to infer whether your Pigweed project is a
18:ref:`Bazel project<module-pw_ide-design-projects-bazel>` or a
19:ref:`bootstrap project<module-pw_ide-design-projects-bootstrap>`. This may
20happen if you have an unusual project structure.
21
22You can resolve it by :ref:`explicitly setting the project type<module-pw_ide-guide-vscode-settings-project-type>`
23in your settings.
24
25.. _project-root:
26
27-----------------------
28Can't find project root
29-----------------------
30The Pigweed extension wasn't able to infer the path to your
31:ref:`Pigweed project root<module-pw_ide-design-projects-project-root>`. This
32may happen if you have an unusual project structure.
33
34You can resolve it by :ref:`explicitly setting the project root<module-pw_ide-guide-vscode-settings-project-root>`
35in your settings.
36
37.. _failed_to_refresh_code_intelligence:
38
39----------------------------------------
40Failed to refresh code intelligence data
41----------------------------------------
42The Pigweed extension failed to refresh the compilation databases or other data
43used to provide code intelligences. Some troubleshooting steps:
44
45* Check the output panel (``Pigweed: Open Output Panel``) to find more specific
46  information about what went wrong.
47
48* Verify that the Bazel ``refresh_compile_commands`` target is configured
49  properly in the top-level ``//BUILD.bazel`` file. There will be relevant
50  content in the output panel if this is not configured correctly.
51
52.. _bazel_no_targets:
53
54---------------------------------
55Couldn't find any targets (Bazel)
56---------------------------------
57The Pigweed extension couldn't find any Bazel targets or target groups to use
58for code intelligence. Here are some troubleshooting steps to follow:
59
60Check the output panel for errors that may have occurred
61========================================================
62Run ``Pigweed: Open Output Panel`` from the command palette. You should see the
63output from the most recent attempt to generate compile commands. If you *don't*
64see that output, you can manually start the process by running
65``Pigweed: Refresh Compile Commands``.
66
67The most common failure here is actually an upstream failure in the Bazel build,
68like missing dependencies or invalid Starlark files. Resolve those problems,
69and the refresh process should restart automatically.
70
71Confirm that the ``refresh_compile_commands`` target is correctly defined
72=========================================================================
73The top-level ``BUILD.bazel`` file contains a call to
74``refresh_compile_commands`` that defines the refresh process target. Any syntax
75or configuration errors in that call will prevent the refresh process from
76running successfully.
77
78Most importantly, ensure that the ``targets`` or ``target_groups`` attributes
79are defined. Defining both is valid too, but at least one must be present.
80