Skip to content

Auto-complete shows non-class members in the class initializer list #4852

@arthurphilippe

Description

@arthurphilippe

Type: LanguageService

I don't know if that qualifies as a bug or if this is the intended autocompletion behaviour.

Describe the bug

  • OS and Version: Archlinux
  • VS Code Version: 1.41.1
  • C/C++ Extension Version:
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

To Reproduce

  1. Start implementing your class constructor;
  2. While initialising your class fields/variables, see how the autocomplete suggest more than a thousand entries, making the one your are looking for impossible to find without looking up the class definition. Most of those entries are defines in the system headers and standard libraries.

Expected behavior
Autocomplete should suggest entries that are relevant to class initialisation, i.e. the variables to initialise.

The same goes when inside the body a function. Seeing everything available in the global scope seems irrelevant to the constructor implementation or any kind of function. But I'm in no way a C++ expert maybe some people actually need those thousands of defines to display like that in a small window.

Screenshots
class constructor example

Additional context
This occurs in other contexts, like when picking the name of a variable: the autocomplete will propose defines and labels from the global scope in a context were it should no suggest anything at all.

image

I'm eager to hear what are your takes on this issues.

Thanks to anyone who is willing to take part on this matter.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions