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

Conan #1213

Closed
Yuri6037 opened this issue May 1, 2020 · 8 comments
Closed

Conan #1213

Yuri6037 opened this issue May 1, 2020 · 8 comments
Labels
more info needed More info is needed from the community for us to properly triage and investigate.

Comments

@Yuri6037
Copy link
Contributor

Yuri6037 commented May 1, 2020

Brief Issue Summary

I recently started to use conan for handling third parties in my project and for some weird reasons, now CMake Tools is like disconnected from IntelliSense.
I just imported cmake-conan helper script that allows CMake configure to automatically run conan install with support for multiple configurations. I've checked under Visual Studio Community and all seem to work fine. However when going into VSCode no more any definitions is identified, all imported names in sub modules are errors.
The project still builds fine under Windows, Mac and even Linux can be checked under Travis.

Expected:

I expected VSCode C++ IntelliSense to correctly resolve symbols with conan enabled.

Apparent Behavior:

IntelliSense for VSCode is completely unable to find any symbols at all not just the symbols of the conan libs. VSCode C++ IntelliSense is like useless on the project now...

Developer Tools Log

I get these errors when opening any file in the project now:
Command: global --encode-path " " -f "c:\Users\Yuri Edward\BlockProject3D\Framework\Compression\include\Framework\Compression\ZInflater.hpp" running...
console.ts:137 [Extension Host] Error: Error: Command failed: global --encode-path " " -f "c:\Users\Yuri Edward\BlockProject3D\Framework\Compression\include\Framework\Compression\ZInflater.hpp"'global' is not recognized as an internal or external command,
operable program or batch file.
global --encode-path " " -f "c:\Users\Yuri Edward\BlockProject3D\Framework\Compression\include\Framework\Compression\ZInflater.hpp" (exited with error code 1)

EDIT: I just captured the entire log of a fresh window reload and sent it to pastebin: https://pastebin.com/9RwNmSbQ

Platform and Versions

  • Operating System: Windows
  • CMake Version: cmake version 3.16.0-rc3
  • VSCode Version: 1.42.1
  • CMake Tools Extension Version: 1.3.1
  • Compiler/Toolchain: Visual Studio Community 2019 Release - amd64
  • Build type: Debug
  • Conan version: Conan version 1.24.1

Other Notes/Information

I'm not entirely sure at which moment in the process of enabling conan it started to fail...

@Yuri6037
Copy link
Contributor Author

Yuri6037 commented May 1, 2020

Wait after a complete re-build from VSCode (delete build folder) let VSCode recreate the build folder, the conan symbols are now correctly resolved but all other symbols are broken. Also weirdly enough I can neither reproduce the bug nor hide it/revert to before it occured.
I will keep trying to find the trigger to the bug...

EDIT: One more bug CMake Tools keeps trying to use Ninja which basically for some reasons doesn't properly support building of dependent targets whereas I told it to use VS Community not Ninja...

EDIT2: Only Windows causes that problem Linux is fine, Linux over SSH is fine, even MacOS is fine.

EDIT3: All right I just closed, reopened editor then it asked me for setting up cpp-tools I said Yes again and now it works...

I don't know if that normal but for some reasons the workspace lost the auto configure cpp-tools setting...

@andreeis
Copy link
Contributor

andreeis commented May 4, 2020

The 1.4 release will have a fix to prevent Ninja from being chosen despite a setting preferring something else.

So, from the later edits of the second comment of this issue, are you unblocked now? Any other problems?

If your project is still not working as expected, it would help us if you make a standalone project that would manifest this issue, so that we use our time debugging the extension, investigating the root cause, finding a workaround and implementing a fix instead of ramping up on the Conan technology and creating a repro from scratch.

@andreeis andreeis added the more info needed More info is needed from the community for us to properly triage and investigate. label May 4, 2020
@joaomcarlos
Copy link

joaomcarlos commented May 17, 2020

I am using the Arduino toolset and having a similar problem (i think), a spam of :

console.ts:137 [Extension Host] Error: Error: Command failed: global --encode-path " " -f "c:\Users\silent\Documents\Projects\airsoft_fcu\airsoft_fcu.ino"'global' is not recognized as an internal or external command,
operable program or batch file.
 `global --encode-path " " -f "c:\Users\silent\Documents\Projects\airsoft_fcu\airsoft_fcu.ino"` (exited with error code 1)

And

console.ts:137 [Extension Host] Error: Error: Command failed: global -u'global' is not recognized as an internal or external command,
operable program or batch file.
 `global -u` (exited with error code 1)

Eventually it will give up completely and I need to restart VSCode:

[Extension Host] undefined
abstractExtensionService.ts:155 Extension host terminated unexpectedly. Code:  3221226525  Signal:  null
_onExtensionHostCrashed @ abstractExtensionService.ts:155
notificationsAlerts.ts:40 Extension host terminated unexpectedly.

I havent touched this project in a few months and now this started happening.

@Yuri6037
Copy link
Contributor Author

Yuri6037 commented May 22, 2020

This issue might be related to #602: it seems that if you get the error of 602 your project IntelliSense support is permanently broken and you fall back under this issue where absolutely no symbols and no macros not even headers can be found due to incorrect or non existant c_cpp_properties.json.
My guess is for some reasons CMake Tools can no longer generate c_cpp_properties after the 602 error.
Any idea why?

EDIT: Fixed by deleting .vscode folder.

@bugproof
Copy link

bugproof commented Sep 24, 2020

Intellisense for packages installed with conan in CMake based project doesn't work at all in vscode. E.g. the path can be C:\.conan\4d8898\1\include on windows. In both VS2019 and CLion it works out of the box. Pretty much unusable if you use conan. If you know the solution I'd appreciate.

https://stackoverflow.com/questions/58077908/linking-conan-include-to-vs-code

I added C:/.conan/** to include paths but it didn't work. Ideally it should include all include folders inside .conan dir. microsoft/vscode-cpptools#723

@euyuil
Copy link
Member

euyuil commented Dec 16, 2020

The following settings won't work either (even if the path is specified explicitly):

"includePath": [
    "${default}",
    "~/.conan/data/**",
    "C:/Users/xxx/.conan/data/**",
    "C:/Users/xxx/.conan/data/catch2/2.13.3/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include",
    "${workspaceFolder}/**"
],

Is the includePath overwritten by configurationProvider? The error message says:

#include errors detected based on information provided by the configurationProvider setting. Squiggles are disabled for this translation unit (<file_path>).C/C++(1696)

@andreeis
Copy link
Contributor

Yes, that's right. If C_Cpp.default.configurationProvider is set to ms-vscode.cmake-tools, then the CppTools extension will ignore c_cpp_properties.json (and compile_commands.json as well).

@github-actions
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
more info needed More info is needed from the community for us to properly triage and investigate.
Projects
None yet
Development

No branches or pull requests

5 participants