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

Feature Request: Generate compile_commands.json #2990

Closed
derdrdirk opened this issue Sep 12, 2019 · 8 comments
Closed

Feature Request: Generate compile_commands.json #2990

derdrdirk opened this issue Sep 12, 2019 · 8 comments

Comments

@derdrdirk
Copy link

derdrdirk commented Sep 12, 2019

I am using emacs with lsp-mode and clangd language server. For code completion the language server need an compile_commands.json file, which can be produced by cmake.

I would love to see a command similar to pio init --ide emacs that produces a compile_commands.json instead of a .clang_complete file, which I need for Intellisense.

@ivankravets
Copy link
Member

See 7a07a2e

Could you re-test with pio upgrade --dev?

@derdrdirk
Copy link
Author

I did and noticed that you produce an additional .ccls file, which is used by the ccls language server. Unfortunately cland, the language server of the llvm developers, uses a ‘.compile_commands.json’ file

@ivankravets
Copy link
Member

How are you going to use clang with compile_commands.json when it's not compatible with GCC flags and other architecture features? It will fail, just try it for AVR.

@derdrdirk
Copy link
Author

Haha. Actually I just want the intellisense to work with cland. For compilation I just the pio pipeline.

@ivankravets
Copy link
Member

Yes, but clang C/C++ Preprocessor will not understand your GCC code. You actually need clang_complete and we generate it https://github.com/platformio/platformio-core/blob/develop/platformio/ide/tpls/emacs/.clang_complete.tpl

@derdrdirk
Copy link
Author

You don’t get me. The .clang_complete file is not read by the cland language server, which is the default language server for the emacs lsp-mode. It’s like the .ccls file for the ccls language server 😉
Anyways thanks for your quick responses. Keep up the good work.

@nghialm269
Copy link

@ivankravets:
Hi, can this issue be re-opened?
Each C++ language servers support its own compile-flag file:

But all of them support compile_commands.json (ccls, clangd, cquery) , so if you can generate compile_commands.json, we can use PIO with any cpp lsp we want, instead of generating .ccls file which only works for ccls.

@ivankravets ivankravets reopened this Oct 26, 2019
@ivankravets ivankravets added this to the 4.1.1 milestone Feb 5, 2020
@ivankravets ivankravets removed this from the 4.1.1 milestone Feb 5, 2020
@ivankravets ivankravets assigned ivankravets and unassigned valeros Feb 5, 2020
@ivankravets ivankravets added this to the 4.1.1 milestone Feb 5, 2020
@ivankravets
Copy link
Member

Please re-test with pio upgrade --dev

See docs https://docs.platformio.org/en/latest/faq.html#compilation-database-compile-commands-json

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

No branches or pull requests

4 participants