Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Guide] C++ language server for local development in VS Code #651

Open
aleclarson opened this issue Oct 6, 2023 · 1 comment
Open

[Guide] C++ language server for local development in VS Code #651

aleclarson opened this issue Oct 6, 2023 · 1 comment
Assignees

Comments

@aleclarson
Copy link
Contributor

aleclarson commented Oct 6, 2023

There's probably a better place for this, but I'll put it here so anyone who is looking can find it.

Note: Android, Windows, and Linux targets have not been added yet.

1. Download the CMakeLists.txt file

wget -O src/CMakeLists.txt https://gist.github.com/aleclarson/361ccb9aaf7540d91630b42e0ae580de/raw/CMakeLists.txt

2. Install compdb

This lets us generate a compile_commands.json file that contains header files, which are missing from the cmake output.

pip install compdb

2. Run cmake and compdb

cd src
cmake -S . -B ../build
compdb -p ../build list > compile_commands.json

After running this, the src/compile_commands.json file should have been generated, which the Clangd language server needs for finding header files and other validation stuff.

3. VS Code extensions

I use VS Code, so I can only help with getting that set up.

In most cases, you'll only need the clangd language server extension. It should work out of the box.

If you plan to add to the CMakeLists.txt file you downloaded earlier, you'll want the CMake extension for syntax highlighting and cmake-format for automatic formatting.

@lamiazar
Copy link
Member

These steps will be added to the repo wiki
https://discord.com/channels/775715380089716778/1092667624237846528/1163515772744773823
cc @chicoxyzzy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants