Intellisense is part of VSCode and not anything to do with PlatformIO itself. It does get a little confused if you make changes to a file, sometimes, and starts “squiggling” left right and centre. Usually a quick build of the project resolves the issue, or as @maxgerhardt has mentioned, rebuilding intellisense does the job.
Intellisense is coming along nicely these days, it has “had its moments” in the past. Personally, I don’t tend to pay much attention to it.
If so, that’s for building libraries that can be uploaded to the PlatformIO libraries repository. So if I created “AVRsomething” as a library and published it, anyone could then add “NormanDunbar/AVRSomething” to their lib_deps and get my library.
For libraries written specifically for a project of your own, the docs are a little sparse (or my searching capabilities are not as good as they should be!) but a Google search came up with this post from @maxgerhardt
and the link to the readme mentioned takes me to this location:
Where we find an example of how to create a library. The gist of which is:
This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.
The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").
For example, see a structure of the following two libraries `Foo` and `Bar`:
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| | |- Foo.c
| | |- Foo.h
| |- README --> THIS FILE
Which does document that under lib you should have a separate directory for each library, and under those, the source and header files for the library are found in src. I have to admit, I’m building a pile of libraries for a new book, and I’ve got the source and headers located in the lib/library-name directory as opposed to lib/library-name/src directory. It works fine though.