vscode intelligense not working properly

kyrpav
Posts: 37
Joined: Wed Jan 29, 2020 8:27 am

vscode intelligense not working properly

Postby kyrpav » Wed Sep 22, 2021 6:32 am

Hello i am using vscode and i have an issue with the intelligence. I used sever versions of esp-idf this did not fix my problem i am currently using the 4.4 and my main issue is that i get recommendations from intelligence but when i go inside lets say a struct intelligence does not follow which means that if i have a struct name time and this had two variables sec and min then when i go to program and call it like:

Code: Select all

struct time t ={
	. //and use the intelligence
	};
Then intelligence shows what ever function or variable. If i start typing it slowly it shorts out but this means that everytime either i have to open the structs to check variable names or i have to remember.

Is there some setup in config that helps to fix this?

I am attaching a screenshot :
Screenshot 2021-09-25 at 10.59.20 AM.png
Screenshot 2021-09-25 at 10.59.20 AM.png (212.02 KiB) Viewed 5211 times
My config file is :

Code: Select all

{
    "configurations": [
        {
            "name": "ESP-IDF",
            "compilerPath": "/Users/kyrpav/.espressif/tools/xtensa-esp32-elf/esp-2021r1-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json",
            "includePath": [
                "${config:idf.espIdfPath}/components/",
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${config:idf.espIdfPath}/components/driver/include",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPath}/components/",
                    "${config:idf.espIdfPath}/components/**",
                    "${config:idf.espIdfPathWin}/components/**",
                    "${config:idf.espIdfPath}/components/driver/include",
                    "${workspaceFolder}/**"
                ],
                "limitSymbolsToIncludedHeaders": true
            },
            "intelliSenseMode": "macos-clang-x64"
        }
    ],
    "version": 4
}

ESP_Dazz
Posts: 308
Joined: Fri Jun 02, 2017 6:50 am

Re: vscode intelligense not working properly

Postby ESP_Dazz » Sat Oct 09, 2021 8:14 am

There could be many reasons why intellisense is not working. Here are some things to consider:
  • In the source file you are modifying, can intellisense navigate to the correct header files when you click on them? Or are they underlined with red. Usually when intellisense cannot find a function from compile_commands.json and the source files includes, it will default to a naive approach and search for whatever source/header in your workspace that contains that same identifier.
  • I don't think it's a good idea to use compile_commands.json AND "includePath" at the same time. Intellisense will also use "includePath" and I'm not sure if compile_commands.json takes precedence. Usually, compile_commands.json is the most accurate it lists the exact include paths required for each source file compiled.
  • Is your struct declaration wrapped by some "#define CONFIG_..."?

toblau
Posts: 1
Joined: Fri Dec 02, 2022 11:03 am

Re: vscode intelligense not working properly

Postby toblau » Sat Dec 03, 2022 11:46 am

In the "settings.json" file in the ".vscode" folder you need to set the "C_Cpp.intelliSenseEngine" property to "Default" instead of "Tag Parser":

Code: Select all

"C_Cpp.intelliSenseEngine": "Default"
However, in my case, with this option, IntelliSense only recognizes the headers after compiling the code. But it correctly expands the members of a structure.

Who is online

Users browsing this forum: No registered users and 19 guests