Author |
Topic |
|
bta
Ketchup Master
Belgium
57 Posts |
Posted - Sep 14 2018 : 04:53:17 AM
|
Hi,
it seems code completion (parameter info) does not kick in when using brace initialization. See example below code to reproduce (foo method). I expect to see the popup showing the possible arguments when I type in the { after the Date (just like when I type in the ( after the Date). Also note that the third line also does not seem to show any parameter info (also not by the default intellisense!).
class Date
{
public:
explicit Date(short day, short month, short year)
: m_day(day)
, m_month(month)
, m_year(year)
{ }
private:
short m_day;
short m_month;
short m_year;
};
void foo()
{
auto d1 = Date(14,9,2018); // code completion kicks in: parameter info shown
auto d2 = Date{14,9,2018}; // code completion does not kick in: no parameter info is shown (or if intellisense is on: intellisense info is shown)
Date d3(14,9,2018); // Strange: no code completion kicks in at all: no parameter info is shown (no VA, no intellisense)
}
Bart
Environment: VA_X.dll file version 10.9.2283.0 built 2018.07.12 DevEnv.exe version 15.6.27428.2027 Professional
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Sep 14 2018 : 09:22:32 AM
|
I am getting parameter information on all 3 lines. One obvious difference is that I am using VS2017 version 15.8.4, so my IDE is more up to date than yours, but I would not automatically expect this to make so much difference.
If you make a new, default solution do you see the same problem? I am wondering if something else in your main solution could be a factor here. |
zen is the art of being at one with the two'ness |
|
|
bta
Ketchup Master
Belgium
57 Posts |
Posted - Sep 14 2018 : 11:42:50 AM
|
Just recreated a new Project from scratch: Visual C++ -> Windows Console Application Pasted the sample code in the cpp file containing the empty main, and the same issues arise as before...
|
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Sep 14 2018 : 2:03:20 PM
|
First up, can you please go to:
VA Options -> System Info -> Copy Info
and paste the details (from the clipboard) into your reply. This will give us the basic information about your setup.
Next, what do you have:
VA Options -> Enhanced Listboxes -> Source of C/C++ content: Visual Assist OR Default Intellisense
set to?
Also, is the IDE intellisense enabled or disabled on your system? The normal method of disabling this is to set:
IDE tools menu -> Options -> Text Editor -> C/C++ -> Advanced -> Disable IntelliSense = True
In my simple tests, intellisense is working as expected for all 3 lines for me, so these are the obvious points where our settings might be different. |
zen is the art of being at one with the two'ness |
|
|
bta
Ketchup Master
Belgium
57 Posts |
Posted - Sep 18 2018 : 09:03:28 AM
|
VA Options:
VA_X.dll file version 10.9.2283.0 built 2018.07.12 DevEnv.exe version 15.6.27428.2027 Professional msenv.dll version 15.0.27428.2027 Comctl32.dll version 6.10.14393.2273 Windows Server 10 10.0 Build 14393.2430 (remote) 36 processors (x86-64, WOW64) Language info: 1252, 0x409
Platform: Custom Stable Includes: C:\DevStudio\Vs2017\VC\Tools\MSVC\14.13.26128\include; C:\DevStudio\Vs2017\VC\Tools\MSVC\14.13.26128\atlmfc\include; C:\DevStudio\Vs2017\VC\Auxiliary\VS\include; C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt; C:\Program Files (x86)\Windows Kits\8.1\Include\um; C:\Program Files (x86)\Windows Kits\8.1\Include\shared; C:\Program Files (x86)\Windows Kits\8.1\Include\winrt; C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\Include\um; C:\DevStudio\Extra_x64\CppUnit_R09_07_005\include; C:\DevStudio\Extra_x64\FlatBuffers_1_9_0;
Other Includes:
Stable Source Directories: C:\DevStudio\Vs2017\VC\Tools\MSVC\14.13.26128\atlmfc\src\mfc; C:\DevStudio\Vs2017\VC\Tools\MSVC\14.13.26128\atlmfc\src\mfcm; C:\DevStudio\Vs2017\VC\Tools\MSVC\14.13.26128\atlmfc\src\atl; C:\DevStudio\Vs2017\VC\Tools\MSVC\14.13.26128\crt\src; C:\DevStudio\Vs2017\VC\Auxiliary\VS\src; C:\Program Files (x86)\Windows Kits\10\Source\10.0.10240.0\ucrt;
Source of C/C++ content: set to Visual Assist
IDE intellisense is disabled: Disable IntelliSense = True In fact the property is set to True and is even greyed out due to Browsing/Navigation > Disable Database = True |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Sep 18 2018 : 2:50:34 PM
|
Thank you for this. What is interesting is that you have some unfamiliar include directories, so I am wondering if using the name "Date" for the test class is a factor. If there is another class in your stable include directories with the same name this could be a factor. It would explain why we are getting different results. So to try and check this, can you please try adding this renamed version of your test code to one of your cpp files, and see what happens on the test line:
class FelineTestVAClassInstanceCreate
{
explicit FelineTestVAClassInstanceCreate(short nCatLegs, short nCatTails)
: m_nCatLegs(nCatLegs)
, m_nCatTails(nCatTails)
{ }
private:
short m_nCatLegs;
short m_nCatTails;
}
void testUsingFelineUniqueNamedClass()
{
// test - place caret into parameter list, between "4" and "1"
// and press CTRL-SHIFT-SPACE, for me tooltip appears
FelineTestVAClassInstanceCreate felineTestHere(4, 1);
} |
zen is the art of being at one with the two'ness |
|
|
bta
Ketchup Master
Belgium
57 Posts |
Posted - Sep 19 2018 : 03:39:20 AM
|
Just pasted your sample code into my project. When just putting the caret into the parameter list and pressing ctrl-shift-space the tooltip appears for me as well. However trying to declare a second variable: FelineTestVAClassInstanceCreate anotherVar (and now typing in the '(' which should show the same tooltip -> not shown)
Similar for trying it with curly braces so a { iso a ( -> same result: no parameter info
So it seems it is not related to the class being confused with some other class declaration.
If you consider the following 4 lines and put the caret inside the parameter list:
FelineTestVAClassInstanceCreate felineTestHere(4, 1); // tooltip shown
FelineTestVAClassInstanceCreate felineTestHere2{4, 1}; // no tooltip
auto felineTestHere3 = FelineTestVAClassInstanceCreate{4, 1}; // no tooltip
auto felineTestHere4 = FelineTestVAClassInstanceCreate(4, 1); // tooltip
So it seems list-initialization (https://en.cppreference.com/w/cpp/language/list_initialization) doesn't work. The case where the tooltip is not shown when declaring a variable and typing the opening ( might be related to C++'s 'most vexing parse' (https://en.wikipedia.org/wiki/Most_vexing_parse)? If you type this code:
FelineTestVAClassInstanceCreate anotherVar();
Then everything compiles. We just declared a function with the name anotherVar which takes no arguments and returns a FelineTestVAClassInstanceCreate. For me the color of anotherVar is also different then the color of the other variables. It is colored as a function and not as a variable. Putting the caret between the brackets and pressing ctrl-shift-space does show a tooltip which shows the function declaration. However when we start typing in the code and get at the opening (, then no tooltip is shown at that time (also not when pressing ctrl-shift-space) So maybe your parser is not yet recognizing it as a variable somehow... The coloring of the variable name (anotherVar) also seems to change. When typing it in (and just stopping typing before the opening ( ), the variable name is shown in 'white' (so not the same color as a variable nor a function). I guess this means it doesn't know yet what it is. When typing in the (, the ) automatically gets added (brace completion) but still variable is white. It only changes color when typing in the semicolon at the end. Then it seems to take a look at the parameter list: if it is empty or comma separated list of only types, then it is considered a function, if it are literals or variable names it is considered a variable declaration. Only when it is considered a variable declaration, the parameter info tooltip is correctly shown.
Note that one of the reasons for having this list initialization introduced in c++ (so with {}) is to avoid this 'most vexing parse' issue.
Why the parameter info is not shown in that case for my environment, but it is shown for your environment is still a question for me. I'll also try upgrading to the latest build. |
|
|
bta
Ketchup Master
Belgium
57 Posts |
Posted - Sep 19 2018 : 03:51:45 AM
|
no difference with VA version 10.9.2283.2 |
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Sep 19 2018 : 07:45:08 AM
|
I think I see what is going on here and why we are getting different results now.
Since there was sample code to copy and paste and test, I was doing this, since it is simple and avoids typing mistakes messing up the tests. So I was testing the fully formed lines, when VA has a good chance of working out if this is a function declaration or a variable being created and initialised. But while the code is being typed, as you already understand, it's sometimes impossible to tell the two cases apart.
That is interesting, I had not realised this is where the {} initializer list syntax came from, but now you say it, it is very obvious and sensible. Unfortunately, as you have worked out, our parser does not yet support / understand the new {} initializer syntax. We are aware of this and it is on our list of features that we need to add, but sadly I don't currently have an estimate for when this is going to be done:
case=75129 |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|