forked from openxla/xla
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR openxla#8306: Add instructions to generate
compile_commands.json
Imported from GitHub PR openxla#8306 Copybara import of the project: -- ef2ff97 by Andrey Portnoy <aportnoy@nvidia.com>: Add instructions to generate compile_commands.json -- 21916c7 by Andrey Portnoy <aportnoy@nvidia.com>: Remove defensive phrasing from LSP instructions Merging this change closes openxla#8306 COPYBARA_INTEGRATE_REVIEW=openxla#8306 from andportnoy:aportnoy/compile-commands-documentation 21916c7 PiperOrigin-RevId: 598964502
- Loading branch information
1 parent
ddf0296
commit e4fc329
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Setting up LSP with clangd | ||
|
||
## Background | ||
|
||
Editors such as Emacs, Vim, or VS Code support features like code navigation, | ||
code completion, inline compiler error messages, and others, through | ||
[LSP](https://en.wikipedia.org/wiki/Language_Server_Protocol), the Language | ||
Server Protocol. A common language server with LSP support is | ||
[clangd](https://clangd.llvm.org), which relies on the presence of | ||
`compile_commands.json`, a JSON file with a record of the compile commands for | ||
each file in a project. | ||
|
||
## How do I generate `compile_commands.json` for XLA source code? | ||
|
||
Use the | ||
[build_tools/lint/generate_compile_commands.py](https://github.com/openxla/xla/blob/main/build_tools/lint/generate_compile_commands.py) | ||
script. The following invocation from XLA repo root generates a | ||
`compile_commands.json` file in place: `bash bazel aquery "mnemonic(CppCompile, | ||
//xla/...)" --output=jsonproto | \ python3 | ||
build_tools/lint/generate_compile_commands.py` |