Hey guys,
It’s been a while since I left VScode behind so was looking to migrate my daisy environment to NeoVim which I’m more comfortable with these days. I used bear to generate compile_commands.json via a make clean && bear -- make which did the trick for getting the correct compiler info to the LSP for autocomplete and “go to definitions” etc. Besides some linter errors confined to the #include "daisy_seed.h" file, it started off great! Was building and flashing fine with make program-dfu and make program (honestly, don’t know how I used to live without the debug probe for instant flashing)
Then all came crumbling down once I wanted to include some c++ standard library functionality. The first was std::array. Linter errors anywhere the array was being declared / used and LSP not aware of the c++ array file. I tried including the path to the toolchain’s c++ include directory /Library/DaisyToolchain/0.2.0/arm/arm-none-eabi/include/c++/10.3.1 in the compile_commands.json. No joy. Think this solved the “go to definition” for the std::array but any array declarations / usage of the array was surrounded with incorrect errors. However, I know this is just a tooling error because the project builds and flashes fine.
So far the best solution has been including the path to the system c++ header files via /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 which is a hacky patch at best as I’m sure there’ll be discrepancies compared to the GNU arm toolchain that daisy uses. Currently this works for std::array but for other standard library functions suchas std::set still have the issue of incorrect errors.
Not sure what else to try here.. I can see that the .vscode’s c_cpp_properties.json simply specifies the compiler path and has no issues, However when trying to replicate this with compile_flags.json my results have been the same or worse than above.
Has anyone successfully setup an environment for coding daisy projects from NeoVim which can include c++ standard library functions? Actually, it’s probably not even a NeoVim specific issue, is anyone using an editor other than VScode? Zed would be a good second best I guess..
Here’s a snippet from c_cpp_properties.json for reference
Thanks!
"cStandard": "c11",
"compilerPath": "/usr/local/bin/arm-none-eabi-g++",
"cppStandard": "c++17",
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],