Apologies in advance about possible use of incorrect terms. Is it autocomplete, intellisense, language server, suggestions or ... ?
Windows11, IDE 2.3.6.
I'm trying to adjust the naming convention that I use in classes. In the past I used to start private variables with an underscore. I'm now trying to adopt a naming convention where any class variable starts with an underscore (less typing than m_); I do not care if they are private or public or protected.
The below code as example
class ClassB
{
public:
ClassB()
{
}
int _x;
int _y;
int z;
};
ClassB b1;
void setup()
{
Serial.begin(115200);
}
void loop()
{
// put your main code here, to run repeatedly:
}
After typing b1. in setup() I only see the member that does not start with an underscore (z).
I wondered whether your example had been mangled in some way by the forum software interpreting what you had typed as HTLM/Markdown/etc
OK, I see now what you mean now
To be explicit you want to precede member variables with an underscore rather than an m followed by an underscore. That was not immediately obvious to me in your first post
However, I am sure that I remember reading somewhere that use of a leading underscore was deprecated due to the possibility of conflict with system variable names or some such. The suggest was, therefore, that trailing underscores should be used, but I cannot find where I read it
What I figured out is that that applies to names with all capitals as used in #define. But reading again I might have misinterpreted that. Guess I will starting using m_.
I just read something that said system vars and anything else that should be hidden are to be preceded by TWO underscores. I think it was a CPP standard but don't quote me on that part.
I am not CPP trained and have only coded one or two classes so I remember them well. I used the format _myVar in the public section and it worked well. It was simply a local copy of one of the parameters.
Each name that contains a double underscore __ or begins with an underscore followed by an uppercase letter ([lex.key]) is reserved to the implementation for any use.
FYI, IntelliSense is Microsoft's name for its "features for programmers in editors", including code completion. Back when Borland made money selling IDEs, their name was Code Insight. A related feature is syntax highlighting. These were "hand-crafted" for languages like C++ and HTML to be included with their IDEs.
Microsoft later developed Language Server Protocol (for Visual Studio Code) to make such support pluggable for any language; it has since become an open standard, used by other editors. That protocol is implemented by (you guessed it) language servers.
An issue like this is in the language server (the back end). It's not the editor itself (the front end) deciding to hide certain things.