Intellisense configuration provider 'nordic-semiconductor.nrf-connect' does not provide completions for unit test projects

Completions for symbols in unity.h and custom, common include files (e.g. test_main.h) are not found by intellisense.

c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64",
            "configurationProvider": "nordic-semiconductor.nrf-connect"
        }
    ],
    "version": 4
}

Tried and didn't work:

  • adding the test project as a separate application
  • adding ${workspaceFolder}/test/inc (location of test_main.h) to includePath or browse.path
  • searched for location of unity.h in SDK and toolchain folders came up with no results. Is it a generated file?

    1258.test.zip

Test project attached ^

Parents
  • Hi Tyler,

    I'm assuming that intellisense is working well for you outside of the symbols you referred to. If so, I think this other case matches the situation you are seeing:  VS Code IntelliSense configuration 

    Please see the last two replies in particular, and see if they fix the issue for you.

    If not, I'll have to check with our developers.

    Best regards,

    Raoul

  • Hi, thanks for looking into this.
    The workarounds in the linked post did not work for me in this case:

    As a temporary fix, you can either:

    Add ""${workspaceFolder}/../library_folder/**" to includePath in c_cpp_properties.json, given that VS code is opened to the project folder(Using "Open Folder...").
    or
    Just open the file manually once. Then VS Code should be able to find it.

    Though the problem in the linked post seems to describe an issue similar to my test_main.h not being loaded as it is included in the CMakeLists.txt using a relative path like so:


    cmake_minimum_required(VERSION 3.20.0)
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(sanity)
    
    test_runner_generate(src/sanity_check.c)
    
    target_sources(app PRIVATE src/sanity_check.c)
    target_include_directories(app PRIVATE ../inc)

    I think the issue with #include <unity.h> is different as that is (to my understanding) provided by the nRF Connect SDK

    Also note, the issues are with code in my unit test projects only. My application sources are all recognized and autocomplete properly

  • Hi Tyler,

    Thanks for specifying. I'll be on leave for the next week and a half, so I'll be transferring this to a colleague, who will help you further. Thanks for your patience!

    Best regards,

    Raoul

Reply Children
No Data
Related