Closed amigo421 closed 6 years ago
Thanks for reporting the issue.
Could you please try with the latest version of VS Code Insiders and the latest version of the extension?
Also, it could help if you would check what's happening in the JavaScript console (Help > Toggle Developer Tools > Console)
As for the standard libs' includes... you're right! I couldn't find how to extract them from CMake Tools :/ If you have ideas, feel free to submit them. I will do my best to implement them.
initially I didn't understand whats happened, and even raised the request for cpptools developers. don't know how but problem with standard headers was resolved.
but damaged c_cpp_properties.json file is a real problem yet.
okay I'll try insiders version and let you know
Ok. Sorry about that. But please note that this behavior is mentioned in the extension's README:
Mirroring the Information in cpptools
Each time CMake Tools Helper is notified, the following happens:
1.CMake Tools Helper
- Gets the current configuration and target name from CMake Tools
- Overrides the content of c_cpp_properties.json using the information from step 1
About https://github.com/Microsoft/vscode-cpptools/issues/795 , the "null" configuration is set when you select a "non typical" CMake target (e.g. "ALL" or "ZERO_CHECK", "clean", etc.) using CMake Toos or if CMake Tools fails to get a list of valid targets (e.g. when the configuration fails)
To have a valid c_cpp_properties.json, select a typical target (i.e. a target that was declared using CMake's add_executable
or add_library
) using CMake Tools.
Again, please check the Developer Tools Console for relevant messages.
@amigo421 I was going over CMake Tools' code when I remembered that the current implementation of CMake Tools Helper relies on the cmake.experimental.useCMakeServer
option to be true
.
Please make sure that this option is enabled.
Hi @amigo421
Do you still face the issue after enabling CMake Server?
sorry for delay, insiders build didn't solve the problem, the same issue, cmake server is enabled in CMakeTools by default. do you need dev console from vscode hel[p menu?
Thanks for the feedback.
That's odd.. I did a few tests but couldn't find out why you would get such a problem.
If you have:
then, this extension should write a valid configuration to the cpptools' json file.
Sure, the dev console log might help, please consider sending it.
Also, if you're familiar with VSCode extension development, you could:
okay, I'll try to debug and let you know about the results
Same thing happened to me literally 5 minutes ago. Fixed it by changing build target from "all" (which was set by default for some reason) to "ALL_BUILD" (which was suggested in the dropdown). Setting target to the one created with add_executable also works.
@exploser Great! Thanks for the feedback.
I'd suggest selecting the targets created by add_executable or add_library. This way, this extension will set the proper includes and defines in cpptools' c_cpp_properties.json ;)
I get this, same problem with missing includes
[Extension Host] rejected promise not handled within 1 second
h.logExtensionHostMessage @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:29
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js:29 Invalid backend promise: Error: Invalid backend promise
at new CMakeToolsWrapper (/Users/gheorghem/.vscode/extensions/vector-of-bool.cmake-tools-0.10.1/out/src/wrapper.js:46:40)
at /Users/gheorghem/.vscode/extensions/vector-of-bool.cmake-tools-0.10.1/out/src/extension.js:17:23
at Generator.next (
Using latest official vscode && pluggins. Points to s cmake-tools though
I'm seeing the same symptoms but slightly different backtrace in the developer console: [Extension Host] rejected promise not handled within 1 second h.logExtensionHostMessage @ extensionHost.ts:320 shell.ts:443 Cannot read property 'forEach' of undefined: TypeError: Cannot read property 'forEach' of undefined at target (/Users/matgra01/.vscode/extensions/maddouri.cmake-tools-helper-0.1.1/out/src/c_cpp_properties.js:29:34) at configuration.parse (/Users/matgra01/.vscode/extensions/maddouri.cmake-tools-helper-0.1.1/out/src/c_cpp_properties.js:37:11) at new configuration (/Users/matgra01/.vscode/extensions/maddouri.cmake-tools-helper-0.1.1/out/src/c_cpp_properties.js:22:14) at prj.targets.forEach.tgt (/Users/matgra01/.vscode/extensions/maddouri.cmake-tools-helper-0.1.1/out/src/c_cpp_properties.js:75:54) at Array.forEach (native) at cfg.projects.forEach.prj (/Users/matgra01/.vscode/extensions/maddouri.cmake-tools-helper-0.1.1/out/src/c_cpp_properties.js:73:33) at Array.forEach (native) at configs.forEach.cfg (/Users/matgra01/.vscode/extensions/maddouri.cmake-tools-helper-0.1.1/out/src/c_cpp_properties.js:72:30) at Array.forEach (native) at c_cpp_properties.parse (/Users/matgra01/.vscode/extensions/maddouri.cmake-tools-helper-0.1.1/out/src/c_cpp_properties.js:71:21) e.onUnexpectedError @ shell.ts:443
I have the same error as above: "TypeError: Cannot read property 'forEach' of undefined"
Looks like just need to check if target has filegroups at line 29 of c_cpp_properties. Will test out if I get a chance.
Having the same issue: TypeError: Cannot read property 'forEach' of undefined
Yeah, looks like some targets just don't have the fileGroups
property. Can confirm that PR #7 fixes the issue.
PR #7 fixes the issues for me as well.
v0.2.0 includes #7
Is this issue still present?
Works well now!
just tried to use, VSCode 1.12.
for sure, select delete and reconfgiure for cmaketools, but no changes in c_cpp_properties.json in other hand , this (by default ) doesn't contain the path to standard libraries and vscode/cpptools can't recognize standard headers location