VSCode Version:
1.15.1
OS Version:
ubuntu 16.04 LTS
extension version:
0.12.3
Steps to Reproduce:
1.install c/c++ extension
2.set C_Cpp.intelliSenseEngine as defult
3.restart vs code
4.find autocomplete doesn't work
I think this might have to do with #981 and the intelliSenseEngine: "Default" setting causing intelliSense parsing to be stuck.
After changing my intelliSenseEngine to "Tag Parser", autocomplete, formatting, etc. seem to work. However, this will reduce the quality of the intelliSense suggestions.
setting intellisense engine as "tag parse" works. And I also find it autocomplete works fine in windows,is it related with OS?
I also noticed this on a non-Windows system (macOS).
With the Default IntelliSense engine, what is your Microsoft.VSCode.CPP.IntelliSense.Msvc.exe doing when you open a file and hover? Is it using lots of CPU, is it crashed, etc.? Autocomplete could fail if it somehow fails to parse the translation unit. Does it work for a simple C++ workspace with just a main function? Yes, it could be OS related.
The Default IntelliSense engine works for a simple file.
However, after opening a file that includes a large header file (like doctest), the CPU usage of Microsoft.VSCode.CPP.IntelliSense.Msvc.darwin is very high and there is a red flame in the status bar with tooltip "Parsing...". At this point, IntelliSense is also no longer working.
For the same files, Tag Parser seemed to work.


@marcrowo Yeah, your issue sounds like https://github.com/Microsoft/vscode-cpptools/issues/981 . I don't know yet if @liuchanchen is experience the same behavior.
I print the process cpu utilization and find the extension usage seems not very high

Actually, the autocomplete even not work in a pretty simply file just like:
int main()
{
int i;
return 0;
}
@liuchanchen Does "main" autocomplete for you? It should be autocompleting using the Tag Parser (even when "Default" is set). "i" shouldn't autocomplete (unless it exists at a global scope elsewhere) because we don't support autocompletion of local variables yet. The enhanced "Default" autocompletion only provides results for after . -> ::. However, I'm seeing that fail to work in this simple example, so I'll investigate Monday:
`class cc
{
int i;
};
int main()
{
cc c;
c. // This is failing to autocomplete.
return 0;
}`
The previous example I posted doesn't autocomplete because we don't autocomplete inaccessible members (in this case, the private variable "i"). I need more info from @liuchanchen on what exactly doesn't autocomplete (because it's working as expected for me).
@sean-mcmanus ,I am sorry for reply so late.
1 The following codes is my another example .I define a global variable cdev , and I want to use this variable in "main",but autocompletion doesn't work at all.
struct mychrdev_data
{
char buf[MYCHRDEV_CAPACITY];
unsigned int headptr;
unsigned int tailptr;
};
cdev_t cdev;
int main()
{
cdev.
}
2 My setting is as follows:
"C_Cpp.intelliSenseEngine": "Default",
"C_Cpp.intelliSenseEngineFallback": "Disabled"
Are these informations helpful for you?
I'm not able to repro the bug still. I had to add these definitions: constexpr int MYCHRDEV_CAPACITY = 10; and after the struct typedef mychrdev_data cdev_t;. Do you see any errors in the Problems window or when you hover over code? I noticed that on Linux, if the typedef is placed before the struct, then autocomplete fails (even though it works on Windowsi), but in both cases, hovering shows an <error-type>.
Actually, the codes I posted is extracted from a source code file which can be compiled correctly. I define MYCHRDEV_CAPACITY as a const number almost like what you do, and add "typedef mychrdev_data cdev_t" after structure define .So I don't think it is syntax error causing autocompletion failing. ''tag parse" (on linux)also works fine in the same file
Does hover give info on the variables involved in the autocomplete? If the member is somehow unavailable then we wouldn't show it (i.e. if "struct" were changed to "class").
So to double check you don't actually use this code you pasted struct mychrdev_data
{
char buf[MYCHRDEV_CAPACITY];
unsigned int headptr;
unsigned int tailptr;
};
cdev_t cdev;
and instead you have a typedef beween the struct definition and the cdev definition, right? Because moving the typedef to other locations would cause the autocomplete to fail.
After updating to 0.12.4, I've found autocomplete to be broken with both the Default and Tag Parser intelliSenseEngine setting.
OS: MacOS 10.12.6
VSCode: 1.16.1
For additional context, the project I'm in is quite large (OpenFrameworks), but I wasn't experiencing any issues in 0.12.3.
@BrianSipple I'm not able to repro a problem with autocomplete. Can you give more details? Does it work with a simple project? What results do you get? Are you using . -> ::? Are other features like hover and Go to Definition working? If you believe cpptools regressed you can try the older version at http://ms-vscode.gallery.vsassets.io/_apis/public/gallery/publisher/ms-vscode/extension/cpptools/0.12.3/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage (renaming the zip to vsix and using the Install from vsix command).
Closing stale issues marked with "more info needed". If you continue to have issues with the extension, please reopen and add some additional information that will help us debug your issue.
Most helpful comment
I think this might have to do with #981 and the
intelliSenseEngine: "Default"setting causing intelliSense parsing to be stuck.After changing my intelliSenseEngine to "Tag Parser", autocomplete, formatting, etc. seem to work. However, this will reduce the quality of the intelliSense suggestions.