-
Notifications
You must be signed in to change notification settings - Fork 365
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
[RFC] vscode support #2845
[RFC] vscode support #2845
Conversation
Although this is a draft, it is ready for comments! |
@joholl I tried it on ubuntu 22.04 (bear installed with apt) But compile_commands.json only contained [] ? |
@JuergenReppSIT Weird, that happens when no files are built by make. The command should rebuild the whole project (depending on how you bear -- make --always-make check-programs |
@joholl I tried the following:
|
@JuergenReppSIT Ah, that clears it up. I used the make target For reference:
|
Many IDEs rely on a llvm compilation database to correctly resolve include paths and other compiler flags. Add a make target for generating a compilation database. This file is automatically detected by many tools such as clang-tidy or the vscode extension clangd. Signed-off-by: Johannes Holland <[email protected]>
Signed-off-by: Johannes Holland <[email protected]>
Add _vscode which can be renamed to .vscode. It contains a launch.json for executing the unit and integration tests (when they are the currently active editor tab). Additionally, launch.json contains the relevant build tasks. Signed-off-by: Johannes Holland <[email protected]>
@joholl Thank you for the fix. Now it worked and I could compile files with clang-tidy |
I like it! |
@joholl I tried: |
@JuergenReppSIT You have to configure clang-tidy via cli options or a .clang-tidy file. See #2847. |
This one might be opinionated.
So far there is no clean way to get first-class language support in vscode. Add make target for creating a compilation database using bear. This enables you to do the following
This file is recognized by many tools including e.g. clang-tidy and the vscode clangd extension. This way, the vscode language server knows exactly where symbols come from, which
#ifdefs
are compiled and where to find the right headers.I also added a
launch.json
which lets you debug single unit and integration tests easily. What do you think of this?Things I thought of but did not want to do in this first step:
Why
_vscode
and not.vscode
? Because this leaves users who want to use their own, different.vscode
with a dirty working tree. Once-tracked files cannot be .gitignore-d and there is no clean way to resolve this.