Language server?
I have been using this plugin for my neovim configuration and i have developed using arduino uno , nano, mega, and even esp32, everything works perfectly but when i tried using the arduino uno r4 wifi the board is successfully downloaded but it cannot seem to read the libraries included in the board an it detects the #Include <Arduino.h> as an error.
Alternatively I have tried using the same setup for the vs code extension of platformio, and it works, it even suggested the built in libraries for the board, i dont know why it does not work with neovim
If you turn on diagnostics message, is this what you were talking about
Config
[env:uno_r4_wifi]
platform = renesas-ra
board = uno_r4_wifi
framework = arduino
Also try using ccls
If you are still confused this is my nvim, as you can see the Arduino functions present as intended, unlike Anurag I use clangd
I forgot if his init file works only for ccls or not but my nvim relies on 2 files, compile_commands.json and compiler_defines.h
brb
OKAY!!!!! I GOT IT!!!!!
so yeah I never see your issue for a while due to work, and most of my contribution is last year so....mb bro
@anurag3301 did use ccls I dont know how good that stuff is, but i use it with clangd things dont work, clangd dont detect any Arduino related completions, it only care with C++ .
I didnt see that because my concern at the moment was Command Completion and my PIO project can autocomplete without any help from this plugins
yeah so basically .ccls dont do crap when using clangd, in my own project I just delete the thing, and create compile_commands.json and compiler_defines.h with the script below(my own, but ripped from a blog)
#!/usr/bin/bash
# This script is not mine, it's based from Ratnadeep Bhattacharyya with my little twist
# Based from this blog: https://skylab.hashnode.dev/platformio-with-neovim
# if there's no Platformio.ini, abort
if [ ! -f ./platformio.ini ]; then
echo "No platformio.ini found, possibly not a PlatformIO project"
exit 1
fi
# Compile the project
pio run -t compiledb
# Clean up existing define files
rm -f _compiler_defines.h compiler_defines.h clang_defines.h
# Generate defines for clang
clang -dM -xc++ /dev/null -c -v -E 2>/dev/null | sed "s/\([^[:space:]]\+[[:space:]]\+[^[:space:]]\+\)\(.*\)/\1/;s/#define/#undef/" >clang_defines.h
# Iterate through compile_commands.json and extract compiler defines
for comp in $(cat compile_commands.json | grep -E "\"command\": \"[^[:space:]]* -o" | sed 's:"command"\: "::g; s:-o.*::g' | sort | uniq); do
set -x
$comp -dM -E -xc++ /dev/null >>_compiler_defines.h
set +x
done
# Combine defines from clang and extracted defines
cat clang_defines.h >compiler_defines.h
cat _compiler_defines.h | sort | uniq >>compiler_defines.h
# Clean up temporary define files
rm -f _compiler_defines.h clang_defines.h
# Update compile_commands.json with additional include flags
sed -i "s:.cpp\",:.cpp -include $${PWD}/compiler_defines.h\",:" compile_commands.json
sed -i "s:.c\",:.c -include $${PWD}/compiler_defines.h\",:" compile_commands.json
Please try it first while using clang as LSP, default settings should suffice
So I retry my finding, making new project, Arduino Uno R4, Framework Arduino
I can use the LSP just fine, mind you the autoimport the one above
and i can just compile just fine, but i dont have the board so the upload would fail obv
can we see you Lspinfo when you in the main.cpp file??