pw_ide: Automatically restart clangd in VS Code
Change-Id: Ie56ce7b208d66884352b23e654dccf3dfe216d1c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/139910
Commit-Queue: Chad Norvell <chadnorvell@google.com>
Reviewed-by: Carlos Chinchilla <cachinchilla@google.com>
diff --git a/pw_ide/docs.rst b/pw_ide/docs.rst
index 4e5a27f..9f21855 100644
--- a/pw_ide/docs.rst
+++ b/pw_ide/docs.rst
@@ -217,6 +217,13 @@
``pw_project_launch.json`` with configurations that conform to the Visual Studio
Code `debugger configuration format <https://code.visualstudio.com/docs/editor/debugging>`_.
+.. tip::
+
+ What's the difference between "Change C++ Code Analysis Target" and "Set C++
+ Code Analyis Target"? "Set" will automatically restart the ``clangd``
+ language server for you to pick up the changed target immediately, while
+ "Change" will not.
+
Selected API Reference
^^^^^^^^^^^^^^^^^^^^^^
.. automodule:: pw_ide.editors
diff --git a/pw_ide/py/pw_ide/vscode.py b/pw_ide/py/pw_ide/vscode.py
index b50aa9f..7a4f7c5 100644
--- a/pw_ide/py/pw_ide/vscode.py
+++ b/pw_ide/py/pw_ide/vscode.py
@@ -289,7 +289,7 @@
},
{
"type": "process",
- "label": "Pigweed IDE: Set C++ Code Analysis Target",
+ "label": "Pigweed IDE: Change C++ Code Analysis Target",
"command": "${config:python.defaultInterpreterPath}",
"args": [
"-m",
@@ -301,6 +301,18 @@
},
"problemMatcher": [],
},
+ {
+ "label": "Pigweed IDE: Set C++ Code Analysis Target",
+ "dependsOrder": "sequence",
+ "dependsOn": [
+ "Pigweed IDE: Change C++ Code Analysis Target",
+ "Pigweed IDE: Restart C++ Language Server",
+ ],
+ "presentation": {
+ "focus": True,
+ },
+ "problemMatcher": [],
+ },
],
}
)