Arduino Web Editor has a "Secret tab" feature that makes it easy to share sketches without accidentally exposing sensitive data (e.g., passwords or tokens). On Arduino Cloud, secrets are stored in a secure database and the secret macro values populated from there.
The secrets database capability is not available when using the Arduino IDE, so a more conventional approach is taken by defining the secrets macros in a header file named arduino_secrets.h. With this approach, the macros will only be defined in a given translation unit after an #include directive for arduino_secrets.h. In Arduino IDE 2.0.0-beta.8, it was necessary to manually add this #include directive to the sketch. The 2.0.0-beta.9 release brings the automatic insertion of this directive into sketches using secrets when they are pulled from Arduino Cloud.
Hi @DickyOZ. Thanks for taking the time to give the beta phase Arduino IDE 2.x a try!
We are aware of these problems with the Arduino Language Server and have several reports in the bug tracker we are using to track the situation. Hopefully the reliability of this feature of the IDE will be improved over time.
For now, you'll need to just ignore these spurious results from the language server. As long as the sketch compiles correctly, you have nothing to worry about.
As you might expect from any beta software, there are some rough edges. If you want a stable experience from the IDE, please use Arduino IDE 1.8.15. The beta Arduino IDE 2.x is not appropriate for normal use at this stage in its development. But if you're interested in helping with the development work on the new Arduino IDE by testing and providing feedback, that is very much welcome. We made it public in its current state to offer the community the opportunity to participate in the work on what will become a cornerstone of the Arduino ecosystem in the years to come.