Skip to content

Commit

Permalink
fix compile_flags.txt to include correct paths
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Jul 25, 2024
1 parent b5b2329 commit 8efd365
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"llvm-vs-code-extensions.vscode-clangd",
"ms-vscode.cpptools",
"abronan.capnproto-syntax",
"DavidAnson.vscode-markdownlint"
"DavidAnson.vscode-markdownlint",
"skellock.just"
]
}
2 changes: 0 additions & 2 deletions compile_flags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
-xc++
-nostdinc
-Ibazel-bin/external/dawn/include
-Ibazel-bin/external/ada-url/_virtual_includes/ada-url/
-Ibazek-bin/external/simdutf/virtual_includes/simdutf/
-Ibazel-bin/external/com_cloudflare_lol_html/_virtual_includes/lolhtml
-Ibazel-bin/external/perfetto/
-Iexternal/perfetto-sdk/sdk/
Expand Down
23 changes: 23 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Development

## Clangd

To get language support in VSCode and other IDEs we recommend using `clangd`-based language server.
The server reads supplied `compile_flags.txt` file for correct options and include paths to resolve symbols
in opened files.

To support `clangd` project-level operations like `Find References` `compile_commands.json` file needs to
be generated that will list all files in the project. If you do this, then it needs to be re-generated periodically
when new files appear.

1. Install `gen-compile-commands`

```sh
just prepare
```

2. Generate `compile_commands.json`

```sh
just compile-commands
```
8 changes: 8 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
prepare:
cargo install gen-compile-commands

compile-commands:
rm -f compile_commands.json | gen-compile-commands --root . --compile-flags compile_flags.txt --out compile_commands.json --src-dir ./src

clean:
rm -f compile_commands.json

0 comments on commit 8efd365

Please sign in to comment.