Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliSense sporadically not working #4720

Closed
hensz opened this issue Dec 9, 2019 · 11 comments
Closed

IntelliSense sporadically not working #4720

hensz opened this issue Dec 9, 2019 · 11 comments
Labels
Feature: Configuration An issue related to configuring the extension or IntelliSense Language Service more info needed The issue report is not actionable in its current state

Comments

@hensz
Copy link

hensz commented Dec 9, 2019

Type: LanguageService

  • OS and Version: SLES 12 SP4
  • VS Code Version: 1.40.2
  • C/C++ Extension Version: 0.26.2

Hi there!

Perhaps this is related to #4479, but since the actual visible issue is different I opened a new issue for this. Also, perhaps this is purely a configuration issue - but I don't have a clue where to look at. Also the issue occurs kind of sporadically.

At the time of writing, it works just fine at least in some files. But most of the time I don't get any suggestions, and when I press Ctrl+Space I either get only weird keywords that match by accident, or I get the "No suggestions" tooltip. In other files I nicely see members and methods of the class I'm currently dealing with, with the correct symbols and all.

I'm using VS Code on Windows with Remote Development connection via ssh to my Linux machine. Also I'm using cmake for my project, and in the VS Code C++ project I've configured compileCommands to point to a valid and recent compile_commands.json file.

Perhaps also interesting: Within one file I encounter both cases: When I press Ctrl+Space in a new line I see some of the local symbols - however not all - with the correct icon and the respective definition. When I select one of these symbols that VS Code is supposed to know, and press '.' nothing happens - and when I press Ctrl+Space again, I see "No suggestions".

So the question is: What's wrong with my setup? How can I diagnose this strange, sporadic issue?

Thanks,
Torsten

@sean-mcmanus
Copy link
Collaborator

When using compileCommands, the browse.path may not be set correctly, so you should check to make sure all root paths to symbols are supplied in that setting. But if you're using CMake, the CMake Tools extension is recommended to get configured, which will supply the correct browse.path setting.

If you run the C/C++: Log Diagnostics command, you can see info on the currently selected translation unit to see if it's using the intended configuration. Enabling debug logging can also help detect configuration erros: https://code.visualstudio.com/docs/cpp/enable-logging-cpp .

@sean-mcmanus sean-mcmanus added Feature: Configuration An issue related to configuring the extension or IntelliSense Language Service more info needed The issue report is not actionable in its current state labels Dec 9, 2019
@hensz
Copy link
Author

hensz commented Dec 11, 2019

Hi!
I don't fully get what I should check in the settings. I don't have browse.path set anywhere, also includePath is unset. And in my compilecommands JSON all paths are absolute paths, so there shouldn't be any problems with root paths.

Regarding logging: I can surely enable logging, but the question is: What should I look for?

I just played around with IntelliSense and enabled logging. However I don't see anything suspicious, except one thing: When I press Ctrl+Space in a new line I see "tag parsing file: ..." in the output window. However I assumed that when using a compilecommands file I shouldn't be using the tag parser.

Can you give me suggestions on what to try out and what to look for in the debug output?

Thanks,
Torsten

@sean-mcmanus
Copy link
Collaborator

If you're compileCommands just references files in your workspace then you shouldn't need to set the browse.path, but if you find that you're missing symbols outside of your workspace then you'll need to add those paths explicitly to your browse.path setting.

"tag parsing file" is normal behavior. The IntelliSense engine uses the tag parser data for global symbol info external to the current TU. The "tag parser" intelliSenseEngine mode is when the global symbol info is the only thing used, with no IntelliSense TU info.

If you see any "fail" or "disconnected" or falling back to tag parser messages in your output then that would be a problem.

@hensz
Copy link
Author

hensz commented Dec 16, 2019

Hi!
As far as I know our code doesn't use any symbols outside of the workspace, everything is self-containing.

As I wrote, I don't see anything in the debug logging, no "fail" or "disconnected". The only suspicious thing was "tag parsing file". Can I get more diagnostic info if this output is indicating a problem, or if it's "normal" for my project?

@sean-mcmanus
Copy link
Collaborator

We need more info on what is failing and how to reproduce it, in particular, I'm not sure if the tag parser or IntelliSense part is failing. When the bug occurs, do you see the missing symbols in the outline view and if you add global scoped symbols that file, do the new symbols update in the Outline view? If that doesn't work, it would mean there's a tag parser failure, possibly doing a Reset IntelliSense Database might fix it. Otherwise, it would indicate there's an IntelliSense process failure -- if you manually terminate the Microsoft.VSCode.CPP.IntelliSense.Msvc process and then hover to spawn a new one, do things start working again? If so, that would indicate the IntelliSense process is getting into a broken state, perhaps after edits occur.

@hensz
Copy link
Author

hensz commented Dec 20, 2019

Hi!
I still cannot see for which symbols IntelliSense (or tag parser) works and for which it doesn't. I tried editing code in some files. Local symbols are "known" most of the time if the outline is updated. Symbols from other files sometimes are "known", meaning that their members are suggested, the types of the members are displayed when howering etc. Other symbols are not "known", when I use these I don't get suggestions. Strangely however, "Goto Definition" takes me to their definition. And this behavior happens only sporadically: The next time I opened the same file, the symbol that previously was unknown now is known.

@sean-mcmanus
Copy link
Collaborator

Yes, if Go to Definition works but IntelliSense squiggles it as unknown, that means the Go to Definition result is being obtained our tag parse database but is unknown to the current TU (IntelliSense), so you're hitting some IntelliSense bug. We fixed a bunch of bugs with https://github.com/microsoft/vscode-cpptools/releases/tag/0.26.3-insiders2, so that might be worth trying.

@Z1Wu
Copy link

Z1Wu commented Apr 22, 2020

  • OS and Version: Macos
  • VS Code Version: 1.44.2
  • C/C++ Extension Version: 0.27.0

Hi @sean-mcmanus, I have the similar problem. I develop c++ project using remote development on a linux machine. In a same prject, some files work perfectly with IntelliSense while in some other files the IntelliSense doesn't work. In the file which IntelliSense doesn't work, tag parser seems work, because I can see symbols in the outline view and anytime I add new symbol the outline view will update properly. And the Go to Definition also work perfectly. But I can't get any suggestion when hit ctrl + space or get any error squiggle when there are some obvious syntax errors.

@sean-mcmanus
Copy link
Collaborator

@Z1Wu It sounds like your IntelliSense process is crashing. We have a fix pending for #5326 which might fix your crash issue. Downgrading to 0.26.3 would also fix your issue if you're hitting that crash (assuming you don't need any of the fixes in 0.27.0). We plan to release a 0.28.0-insiders with the fix on Monday probably.

@hensz
Copy link
Author

hensz commented Apr 28, 2020

Hi!
Just to update on my status: I now use version 0.27.0, and also I updated my compile_commands.json, and now IntelliSense seems to work fine again. Thanks a lot for your patience :-)
From my perspective the issue can be closed now.

@sean-mcmanus
Copy link
Collaborator

@hensz FYI, 0.27.0 does have some known crash issues in cpptools and cpptools-srv that we plan to fix in our next release.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature: Configuration An issue related to configuring the extension or IntelliSense Language Service more info needed The issue report is not actionable in its current state
Projects
None yet
Development

No branches or pull requests

3 participants