Compiler querying on Linux/Mac sometimes get stuck reading from stdout
Bug type: Language Service
Describe the bug
- OS and Version: MacOS 10.15.7
- VS Code Version: 1.55.2
- C/C++ Extension Version: v1.3.1
- Other extensions you installed (and if the issue persists after disabling them): Python v2021.4.765268190
- If using SSH remote, specify OS of remote machine: N/A
- A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).
I can't seem to get Intellisense working for C++.
Steps to reproduce
-
Make a new C++ file with this trivial code:
#include
float foo () { std::vector
bar; } -
Hover mouse over "bar". I expect it to tell me information about this variable, but it just says "Loading..."
-
Add a line:
bar.
Now at that point, I might expect it to pop up a list of methods I can use for bar. But nothing happens.
In contrast, if I make a new file that is Python, all the usual Intellisense features (for Python) work exactly as expected. It's only C++ where I'm having a problem.
I'm not sure what to try next or how to figure out why this isn't working.
When I try to run "C++ edit configurations", that also does nothing!
@lgritz
When I try to run "C++ edit configurations", that also does nothing!
This could mean that the C++ extension was not properly installed. Could you try un-installing and re-installing the C++ extension?
Note: the IntelliSense features for Python is separate from the C++ extension. That is the Python features are from the Python extension https://github.com/Microsoft/vscode-python.
@michelleangela Hi, thanks, and sorry for the delay in replying.
Un-installing and re-installing the C++ extension does not help (nor does uninstalling and re-installing the entire VSCode).
Yeah, I understood that the Intellisense features for Python are from a different extension; I just thought that knowing that other plugin worked might help you narrow down the set of things that could be going wrong.
I find the fact that "C++ edit configurations" doesn't seem to do anything at all is very interesting. It's probably a wide part of the C++ extension that for some reason is not working properly, not just intellisense.
I find the fact that "C++ edit configurations" doesn't seem to do anything at all is very interesting. It's probably a wide part of the C++ extension that for some reason is not working properly, not just intellisense.
If all of the C++ extension commands are not working then it's likely the whole extension is having an issue and not the just IntelliSense feature. The IntelliSense features are provided by the cpptools and cpptools-srv processes, and the TypeScript portion of the extension talks to the cpptools process. Some commands, like the "C++ edit configurations" mostly involve work on the Typescript code and can run independently from the cpptools and cpptools-srv processes. Are both "C++ edit configurations (UI)" and "C++ edit configurations (JSON)" not working?
Could you double check the installation path of the vscode extensions: ~/.vscode/extensions and verify that all folders of "ms-vsocde.cpptools.*" are deleted after uninstalling? If there are folders for the C++ extensions, you can safely manually delete them.
Also, how did you install the C++ extension? Through the VS Code marketplace or using an offline VSIX from https://github.com/Microsoft/vscode-cpptools/releases? If initially through marketplace, could you try the offline VSIX?
If installation seems correct (no installation errors, no other folder versions of the extension are installed) and cpptools process is running, could you set "C_Cpp.loggingLevel" to "Debug" and share any log outputs?
@sean-mcmanus do you have any other ideas as to what's causing a command not to work?
Also, might want to check the Help->Toggle Developer Tools->Console to see if you see logging from our extension with text "activating extension" (if not, our extension isn't activating...the Edit Configuration command itself should trigger an activation). If the offline vsix's still don't help, you might want to try debugging the issue yourself (see https://github.com/microsoft/vscode-cpptools/blob/release/Documentation/Building%20the%20Extension.md ).
@lgritz : I have the similar issue in C/C++ Extension Version: v1.3.1. if I installed the previous version (e.g. 1.3.0). the extension works again.
@lgritz could you verify if this is still an issue with the latest version of C++ Extension (version 1.4.1 or insiders)??
@rafaelchen could you verify if this is still an issue with the latest version of C++ Extension (version 1.4.1 or insiders)?
@rafaelchen could you verify if this is still an issue with the latest version of C++ Extension (version 1.4.1 or insiders)?
@michelleangela the issue disappears with latest version now, thanks.
Hi, I'm still having trouble. Fresh VSCode install, cleared out ~/.vscode, reinstalled the latest C++ extension.
When I set the logging level to debug and open the developer console, I see errors like these:
electron/js2c/renderer_init.js:61 The vm module of Node.js is deprecated in the renderer process and will be removed.
workbench.desktop.main.js:62 [Extension Host] (node:88809) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.(Use `Code Helper (Renderer) --trace-deprecation ...` to show where the warning was created)
[Violation] 'setTimeout' handler took 60ms
[Violation] Forced reflow while executing JavaScript took 56ms
DevTools failed to load SourceMap: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/507ce72a4466fbb27b715c3722558bb15afa9f48/core/vs/workbench/workbench.desktop.main.js.map: Load canceled due to load timeout
Is any of that relevant?
Those errors don't seem relevant. If those are the only logs you're seeing in the developer console then it appears our extension is not activating. Have you opened a C/C++ file or invoked a C/C++ command to trigger the activation? Are you able to get other extensions to activate?
Other extensions all seem fine. It's only C++ that I'm having trouble with.
Yes, I have a small C++ file that I'm using to test.
You're installing the C/C++ extension via the marketplace? Version 1.4.1? When you do that, do you initially see downloading logging messages, because it's supposed to download our macOS-specific binaries after the initial install. Have you tried installing an offline vsix: https://github.com/microsoft/vscode-cpptools/releases ?
@michelleangela @Colengms Any ideas? Seems like it could be a VS code bug.
I was installing from the marketplace. Yes, 1.4.1. I uninstalled the extension and re-installed by downloading the vsix. Still fails, but I get this in the log window.
[2021-06-28 15:54:19.899] [exthost] [info] extension host started
[2021-06-28 15:54:19.947] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication {"startup":false,"extensionId":{"value":"vscode.microsoft-authentication","_lower":"vscode.microsoft-authentication"},"activationEvent":"onAuthenticationRequest:microsoft"}
[2021-06-28 15:54:19.948] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code.app/Contents/Resources/app/extensions/microsoft-authentication/dist/extension.js
[2021-06-28 15:54:19.955] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.cpptools {"startup":false,"extensionId":{"value":"ms-vscode.cpptools","_lower":"ms-vscode.cpptools"},"activationEvent":"onLanguage:cpp"}
[2021-06-28 15:54:19.955] [exthost] [info] ExtensionService#loadCommonJSModule file:///Users/lg/.vscode/extensions/ms-vscode.cpptools-1.4.1/dist/main
[2021-06-28 15:54:19.981] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"extensionId":{"value":"vscode.debug-auto-launch","_lower":"vscode.debug-auto-launch"},"activationEvent":"*"}
[2021-06-28 15:54:19.981] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code.app/Contents/Resources/app/extensions/debug-auto-launch/dist/extension
[2021-06-28 15:54:19.983] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"}
[2021-06-28 15:54:19.983] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/main
[2021-06-28 15:54:20.132] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug {"startup":false,"extensionId":{"value":"ms-vscode.js-debug","_lower":"ms-vscode.js-debug"},"activationEvent":"onCommand:extension.js-debug.clearAutoAttachVariables"}
[2021-06-28 15:54:20.132] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/extension.js
[2021-06-28 15:54:20.218] [exthost] [info] ExtensionService#_doActivateExtension vscode.github {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"}
[2021-06-28 15:54:20.218] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code.app/Contents/Resources/app/extensions/github/dist/extension.js
[2021-06-28 15:54:20.273] [exthost] [info] eager extensions activated
[2021-06-28 15:54:20.282] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication {"startup":false,"extensionId":{"value":"vscode.github-authentication","_lower":"vscode.github-authentication"},"activationEvent":"onAuthenticationRequest:github"}
[2021-06-28 15:54:20.282] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code.app/Contents/Resources/app/extensions/github-authentication/dist/extension.js
[2021-06-28 15:54:20.287] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":false,"extensionId":{"value":"vscode.emmet","_lower":"vscode.emmet"},"activationEvent":"onStartupFinished"}
[2021-06-28 15:54:20.287] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code.app/Contents/Resources/app/extensions/emmet/dist/node/emmetNodeMain
[2021-06-28 15:54:20.291] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":false,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"onStartupFinished"}
[2021-06-28 15:54:20.291] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code.app/Contents/Resources/app/extensions/merge-conflict/dist/mergeConflictMain
[2021-06-28 15:54:20.292] [exthost] [info] ExtensionService#_doActivateExtension vscode.testing-editor-contributions {"startup":false,"extensionId":{"value":"vscode.testing-editor-contributions","_lower":"vscode.testing-editor-contributions"},"activationEvent":"onStartupFinished"}
[2021-06-28 15:54:20.292] [exthost] [info] ExtensionService#loadCommonJSModule file:///Applications/Visual Studio Code.app/Contents/Resources/app/extensions/testing-editor-contributions/dist/extension.js
[2021-06-28 15:54:43.857] [exthost] [error] onWillSaveTextDocument-listener from extension 'ms-vscode.cpptools' threw ERROR
[2021-06-28 15:54:43.860] [exthost] [error] Error: timeout
at Timeout._onTimeout (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:30165)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
[2021-06-28 15:55:13.736] [exthost] [error] onWillSaveTextDocument-listener from extension 'ms-vscode.cpptools' threw ERROR
[2021-06-28 15:55:13.736] [exthost] [error] Error: timeout
at Timeout._onTimeout (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:30165)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
[2021-06-28 15:55:27.376] [exthost] [error] onWillSaveTextDocument-listener from extension 'ms-vscode.cpptools' threw ERROR
[2021-06-28 15:55:27.376] [exthost] [error] Error: timeout
at Timeout._onTimeout (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:84:30165)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
Are you on an ARM64 M1 mac?
Intel MacBookPro 2019 16" running Catalina 10.15.7
That log window doesn't show everything. Can you view the Help->Toggle Developer Tools->Console and look for "activating extension" (it should also show the path to the extension) and any errors from our extension?
[Extension Host] activating extension
console.ts:137 [Extension Host] starting language server
But nonetheless, hovering mouse over a symbol just shows "Loading..." forever. Also, using the command palette to select any of "C/C++: Edit configurations (UI)", "C/C++: Edit configurations (JSON)", or "C/C++: Reset Intellisense Database"... all do nothing discernible at all.
Is it possible that this is a permissions problem? Like, some MacOS permissions need to be set for VSCode that I'm lacking?
The extension activating is good -- it means the install looks okay.
Your database might be being created in an invalid location (which it may not have write permissions for). Can you set the workspace folder's C_Cpp.default.browse.databaseFilename to something like "${workspaceFolder}/.vscode/vc.db" to make sure that file is getting created? If that still doesn't work, can you enable our debug logging (see https://code.visualstudio.com/docs/cpp/enable-logging-cpp)?
Also, when you close VS Code, can you make sure no cpptools processes are running and then check if one gets started after opening VS code?
Yes LOTS of copies of ~/.vscode/extensions/ms-vscode.cpptools-1.4.1/bin/cpptools still running even after exiting vscode.
Killed them all, then restarted vscode. Did not help.
Changed the databaseFilename as specified, also doesn't seem to help. And no matter what I do to test it out, I never see a vc.db file show up in .vscode in that folder, including if I "rescan workspace" or "reset intellisense database".
Cpp logging level was already set to "debug". But interestingly, I don't see "C++" as one of the choices in the pulldown choices of filters in the output window.
Is maybe there something misconfigured that is screwing me up, that somehow survives an uninstall and reinstall of VSCode itself? Something tucked away in my ~/Library or similar? What is the simplest way to get my account and machine to the state where I never had VSCode installed at all? Maybe if I can get back to that point and start fresh, I will have better luck. At some point in the distant past, I did have this seemingly working!