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

include all libraries in compilation database #2600

Open
3 tasks done
Shoxx98 opened this issue May 11, 2024 · 1 comment
Open
3 tasks done

include all libraries in compilation database #2600

Shoxx98 opened this issue May 11, 2024 · 1 comment
Labels
type: enhancement Proposed improvement

Comments

@Shoxx98
Copy link

Shoxx98 commented May 11, 2024

Describe the request

clangd-based projects often use compilation databases for definition linking.
The most convenient setup to set up for developing firmware for arduino-based microcontrollers in neovim currently is to have a workflow also including lspconfig, arduino-language-server, clangd and arduino-cli. However, this does not work so well, as the library linking during editing is not fully there , so the workflow gets disrupted by not working goto_definition functionality and code completion.
If you want to have this obligatory functionality working, you would have to ditch the arduino-language-server and move to compilation databases generated by arduino-cli or platformio.
However, both lack the feature to link a complete set of system libraries, so the issue persists on the alternatives.
E.g.: If you try to #include <stdlib.h> in any file, it will not be found during code editing. I have not yet confirmed if the code generated by arduino-cli even works using this setup, but, looking at these issues, I have very little hope.

The workaround used by Visual Studio (and potentially the arduino IDEs) generates their own files to link everything, but their approach could change and is not processed by clangd (as it should be!).

Apparently, a workaround currently exists, but is imo difficult to setup (as I have not succeeded in doing so) and is, well, only a workaround.

related issues:
#1286
Softmotions/acdb#2

Describe the current behavior

arduino-cli compile -b arduino:sam:arduino_due_x --only-compilation-database --build-path=$PWD/build - does not link to all libraries used to compile the project

Arduino CLI version

arduino-cli Version: 0.35.3-arch Commit: 95cfd65

Operating system

Linux

Operating system version

6.8.9-4-cachyos

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details
@Shoxx98 Shoxx98 added the type: enhancement Proposed improvement label May 11, 2024
@Shoxx98
Copy link
Author

Shoxx98 commented May 11, 2024

just now I tried this solution, deleting the last 2 lines in the setup script and it works (uses platformio):
https://docs.platformio.org/en/stable//integration/compile_commands.html

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

No branches or pull requests

1 participant