question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generate "compile_commands.json" for LSP ready IDEs

See original GitHub issue

The following command generates the requires files for LSP for plugins like coc-nvim:
pio project init --board my_board --ide vim --project-option "framework=arduino" Problem is, after mutating the platformio.ini and adding libraries, the .ccls file is not kept updated.
How to make it so that all these auxiliary helper files get updated when project dependencies change? I was able to do it with
initing again.
Aside from that, I don’t think the .ccls file should be dependent on project libs alone. Maybe the source does not use a library, so its deps should not be handled by ccls.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
ivankravetscommented, Nov 14, 2020

Yes, it makes sense to generate compile_commands.json in the root of project.

2reactions
ivankravetscommented, Apr 9, 2022

See updated docs https://docs.platformio.org/en/latest/integration/compile_commands.html

Key changes:

  1. The latest PlatformIO Core generates a compilation database in the project root
  2. The new build environment was added to include toolchain paths. See docs for details.

Please confirm that it works now upgrading to the latest development version of PIO Core using pio upgrade --dev. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring Emacs as a C/C++ IDE - LSP Mode
In order to generate compile_commands.json for Emacs itself I have found that Bear works fine. sudo apt-get install bear.
Read more >
Lsp-mode when I can't generate compile_commands.json
The C codebase I'm working on has a very complex build system and it can only build it in windows :(. Everyone on...
Read more >
Generating compilation database from GN - Google Groups
I think we could implement this via --json-ide-script, i.e. have a Python script that consumes the --ide=json output and transforms it into compile_commands....
Read more >
emacs-lsp/lsp-mode - Gitter
Now when I run helm-lsp-diagnostics I get a lot of compiler errors, including one saying something like '-fconcept is unknown'. I could discard...
Read more >
559674 – Improve parser for compile_commands.json - Bugs
Next step would be to take your existing code and integrate it into CDT. I suggest creating a gerrit* for review and legal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found