ReSharper C++ does not work with CMake projects in VS2017

I'm using a CMake project using VS2017 and I've installed ReSharper Ultimate along with it. In a normal project everything works fine, I can jump to declarations, include header files via ALT+Enter etc.

 

However, none of ReSharpers functionality works with CMake based projects, none of it. I hit ALT+Enter and all I get is a sound notification. Nothing pops up, I can't jump to declarations either. Is there a way I can get ReSharper to work with my project?

13 comments

Hello Liam,

ReSharper 2017.1 EAP 4 (will be available tomorrow from https://www.jetbrains.com/resharper/eap/) will support CMake-based projects.

Thanks!

1

Liam,

The EAP 4 build is now public. If you have a chance, please try it with your CMake solution and let us know how it goes. 

Thanks!

0

Hi, I just installed the new EAP 4 build and it still doesn't work as it should. I can now use ALT+Enter at which point I get a context menu with the two options: "Navigate to", and "Generate code" however I can't use it to do anything else such as include a header file for a class. I also cannot use CTRL+Click to navigation to the declaration of a class or function etc.

0

Liam, sorry it didn't work for you. Would you be able to share this project with us or send us another repro project which has the same problem?

0

Of course, here are my project files. https://mega.nz/#!IApViQ5C!YUXPUKwwN18ECxMdVql6UAdpQRyr62153ENGSoH9WAk

EDIT:

Okay, after restarting VS2017 about 5 times the functionality is now working

0

Liam, it worked for me too - please make sure however that you've waited until CMake has finished generating the solution and R++ has finished updating source files (there's a progress in the status bar during that process) after a new project is opened. If you see any other problems with CMake, please let us know. Thanks for trying it out!

0

Doesn't work for me either. I am using VS2019 (16.1.3)

My Open Folder CMake Project uses target_include_directories for includes and the includes are marked red (not found) by Resharper for C++ - unlike before with Visual Assist. I tried stopping devenv, deleting cache and .vs folders and then starting devenv again and waiting really a long time (several minutes) - it didn't change anything. Compiled my project again - which worked including tests and still stuff is marked red. My targets are listed in the CMake target view of solution explorer and compile correctly. Regular stdlib includes are found.

I like the feature set and am currently evaluating - but this is really a showstopper for me.

0

Chris, is it possible for you to share this solution or create a similar test one for us to investigate?

R++ gets compilation properties from Visual Studio in CMake projects. You can take a look at them by starting Visual Studio with the "/ReSharper.Internal" command-line option, then Alt+Enter in a file and typing "Dump C++ IntelliSense Info". This should open a text editor with the data collected from VS (if it's empty, VS is probably still parsing the solution).

0

I made a zip file of a small test solution including 2 screenshots and the Dumped info (I did it over the menu, like shown in the 2nd screenshot)
Where should I send it and how?

P.S.: I am not using R - this is totally not R related in any way. It's a simple small CMake "Open Folder" C++ project with 2 subdirectory based subprojects and catch2 tests.

 

0

Another issue is loading speed (For my original project):
As you can see in the attached image the machine is totally not saturated (though not the fastest), but the loading stays like displayed for dozens of minutes (Actually it's still loading after deleting .vs and CMake cache + build folder and restarting).We have a ton of external dependencies, boost, etc ... It it seems like resharper is scanning virtually everything, even stuff we don't use. Dependency tests and examples etc ...

0

Please attach them to https://youtrack.jetbrains.com/issue/RSCPP-26511.

R++ by default indexes all files which are included into the solution, even headers which are not included anywhere (so that e.g. navigation and auto-import work with symbols from such headers). Usually big external libraries like boost are not included into the solution, so it's not an issue. This behavior seems to be problematic on CMake solutions, which often include all the library headers. We might switch to not indexing headers like this by default.

As a workaround you can exclude the libraries from indexing manually by adding a file mask on the "ReSharper | Options | Code Editing | Third-Party Code" settings page (see https://www.jetbrains.com/help/resharper/Reference_Options_Code_Editing_Third_Party_Code.html).

0

Addendum: Restricting the directories for files to read helped a lot with the performance issues, but the "red header file" problem remains.

0

Please sign in to leave a comment.