Skip to content

Code completion weird behavior #14013

@zamek42

Description

@zamek42

Environment

  • OS and Version: Debian GNU Linux 13
  • VS Code Version: 1.105.1
  • C/C++ Extension Version: Espressif IDF Extension 1.10.2

Bug Summary and Steps to Reproduce

Is it possible that VSCode code completion only offers those elements in the list that I have already used, but does not read the header files of glibc and the given environment? I use the Espressif plugin and I am surprised to find that, for example,

arg_print_syntax(stdout, (void *) &blink_args, "\n");

I want to call it, I press ctrl space after "arg" and it does not offer it, even though at the beginning of the file there is

#include "argtable3/argtable3.h"

If I type it in and recompile it, it offers it, but only that,

arg_print_glossary(stdout, (void *) &blink_args, "%-25s %s\n");

it does not offer it again until I type it in and compile it. The path to the esp-idf components libraries is set in c_cpp_properties.json:

"includePath": [
"${config:idf.espIdfPath}/components/",
"${config:idf.espIdfPathWin}/components/",
"${config:idf.espAdfPath}/components/",
"${config:idf.espAdfPathWin}/components/",
"${workspaceFolder}/**"
],

The eclipse plugin reads all the libraries accurately and offers them.

Another problem is that, for example, if I want to request code completion for the elements of a struct, typing . after the variable name and pressing ctrl+space will display not only the elements of the struct, but all the elements it matches. The Eclipse does this perfectly as well.

And when I try to insert any header file that hasn't been used before in the include section at the beginning of the file, I won't get a list there, neither of the headers belonging to glibc nor of the headers belonging to my headers.

A C code contains 500-1500 files, which means about the same number of header files, if there are only 15 names in each file, then this means 7500-22000 identifiers, I don't want to keep that in mind.

Expected behavior:
VSCode should build a list of header files read based on includePath, and the code completion list should be context sensitive.

Here is an Eclipse correct snapshot:

Image

Configuration and Logs

{
  "configurations": [
    {
      "name": "ESP-IDF",
      "compilerPath": "${default}",
      "compileCommands": "${config:idf.buildPath}/compile_commands.json",
      "browse": {
        "path": [
          "${config:idf.espIdfPath}/components/**",
          "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
      }
    }
  ],
    "limitSymbolsToIncludedHeaders": false,
  "version": 4
}

Other Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions