Intellisense not showing for lib_extra_dirs

Deleting .pio and .vscode folders in your existing projects should fix this.

I made a new workspace and put your libs and projects into it.

projectA compiles without errors. The keyword “symlink” seems not to be the problem.

lib_deps =
  symlink://../../libraries/LibA

Will try

Did I mention that I’m ALWAYS using only workspace with just one single project in it?

Otherwise VS-Code / IntelliSense (/ maybe also PlatformIO) often get’s confused.
I don’t use .workspace files.

I’ll right click the folder which holds the project files and choose “Extended Options… / Open with Code”. Doing so I’ll always have a fresh “workspace”

See https://www.youtube.com/watch?v=MGKI_Jvef9o

Deleting .pio and .vscode completely rebuild the project and linked the dependencies anew. Building and compilation without errors. The suggestions and Intellisense work, but…

Following the header files I found another inaccuracy. The library files are opened inside the folder “lib/deps”.
image

Changing the files here does not change the original file in …/libaries/Core. The suggestions work here only

Changing the original file …/libaries/Core/Core.h in its original location does not change the file in “lib/deps/Core” and does not change it after rebuilding. Also the suggestions do not work when opening the original file.

What is the correct way to resolve this issue? Can I replace the original file inside a project via “lib/deps”?

I have mentioned this a few posts before.

That’s the behavior when you use lib_deps = file://...
The library will be cloned into the libdeps folder

This won’t happen if you use lib_deps = symlink://...
With symlink a “libraryname.pio-link” file is created instead!
See my post with the screenshot few posts above.

Check the project’s from my Repo!

In my current way of organizing this is not possible. I have multiple workspaces with multiple projects. They are categorized between research_projects, students, laboratory, equipment, …

Basically every “whole project” has its own workspace.

I will try to get “symlink” to work using your repo.

Personally, I think that’s a matter of taste how to organize things.
I’ll handle this by having folders on my harddrive

Anyways, having just a single project open at a time solved all my issues.

But you said projectA worked without issues?
This implies that symlink was working correctly?!

Check the content of .pio/libdeps/nanoatmega328 from projectA

Yes. Your environment from the repo is working as intended.

I am currently checking the differences between my project and yours. Here are my first results:

Ok, sorry then for the misunderstanding :innocent:

The behavior of file:// and symlink:// is described here: pio pkg install — PlatformIO latest documentation

I added a basic library.json to all dependent libs. Now

lib_deps = 
    ricaun/ArduinoUniqueID@^1.2.0
    symlink://../libaries/Core
    symlink://../libaries/Parameter/
    symlink://../libaries/Logging
    symlink://../libaries/MCP2515_CAN

Compiles without erros and when following the header files, the files in the original location “/libaries/Core” are opened. My project looks and feels more dynamic and better organized.

But: The suggestions in “Core.cpp” are not working again.

Yeayy! :partying_face: :tada: :dancing_women:

Unfortunately that’s something you have to live with and can’t be changed.
Reason: The library folder itself is “out of scope” or better “not related to a project” for IntelliSense. Even if it is #include’d by some project.

This seems to be the conclusion.

Until our institutes next process meeting I will work on a new way of handling our shared code (guidelines, templates, commit rules,…). Since this issue is only an issue when I work simultaneously on two projects sharing the same library (e.g. handshakes via bus). When working on one project, I will try to work without “symlink”. When ready I will try the following steps:

  • Commiting the library files
  • Change the build/ platform.ini to use “symlink”
  • Start testing the projects code with a released library

@sivar2311 Thanks for your investigation. My problem is not solved, but the issue is understood. Your help was very appreciated, since it cleaned up my dependencies and will make working together more fluent.

1 Like

In the project directory there is a .vscode folder, in which there is a c_cpp_properties.json file.
Open it and add the paths to lib_extra_dirs with ** on the end

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:/Projects/PlatformIO/libs/**",
                "${env:USERPROFILE}/.platformio/packages/framework-espidf/components/**",
                "${env:USERPROFILE}/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/**",
                "${env:USERPROFILE}/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/**",
                "${env:USERPROFILE}/.platformio/packages/toolchain-xtensa-esp32/lib/gcc/xtensa-esp32-elf/**",
                "${env:USERPROFILE}/.platformio/packages/toolchain-xtensa32/lib/gcc/xtensa-esp32-elf/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64",
            "compileCommands": "${workspaceFolder}/.pio/build/esp32dev/compile_commands.json"
        }
    ],
    "version": 4
}

The first line “c_cpp_properties.json” is a warning

//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//

After adding the line to the <>.json

{
    "configurations": [
        {
            "name": "PlatformIO",
            "includePath": [
                "D:/GCLib/atom/libaries/**",
                all other libs
             ]

the projects compiles without errors. The suggestions are still not showing and the variables are just in plain white.