Skip to content

Commit

Permalink
Add zed and clangd config
Browse files Browse the repository at this point in the history
  • Loading branch information
mlund committed Jul 23, 2024
1 parent 4124b1c commit e50b196
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CompileFlags:
CompilationDatabase: "build/"

18 changes: 18 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#folder-specific-settings
{
"languages": {
"C++": {
"tab_size": 4,
"formatter": {
"external": {
"command": "clang-format",
"arguments": ["{buffer_path}"]
}
},
"format_on_save": "off"
}
}
}
11 changes: 10 additions & 1 deletion docs/_docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ To force a specific location, use `-DZLIB_ROOT=...` in a clean build directory.

We recommend to use an IDE or text editor that respect the provided `.clang-format` which will ease merging
changes into the codebase, see below.
For Visual Studio Code (VSC) users, it is very easy to setup a development environment using Docker and
For Visual Studio Code (VSC) users, it is easy to setup a development environment using Docker and
[Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers):

~~~ bash
Expand All @@ -186,6 +186,15 @@ code .

(when asked, select "open in devcontainer", assuming you have Docker running)

## Clangd

For editors with `clangd` support, we provide a `.clangd` configuration file.
This looks for a CMake generated `build` path that should contain
`compile_commands.json`.
If you use a custom build directory, simply create a symlink called `build`
in the project root.
If your build directory doesn't contain `compile_commands.json`, you can create
one with the CMake argument `-DCMAKE_EXPORT_COMPILE_COMMANDS=on`.

## Code Style

Expand Down

0 comments on commit e50b196

Please sign in to comment.