SlicerCAT : Visual Studio Intellisense does not working

Operating system: Windows 10
Slicer version: latest on github(i think)
Expected behavior: IntelliSense must properly assist with autocomplete.
Actual behavior: The items provided in autocomplete are only those that are actually included in this project. (.vs, out, Resources, Widgets, qSlicerAppMainWindow …)

Hello, I am someone who has primarily been developing apps using Python with Qt, VTK, and ITK libraries until now. As such, I am not very familiar with Slicer, Visual Studio, C++, CMake, etc. Please understand if my questions seem a bit basic.

I followed the instructions from SlicerCustomAppTemplate (GitHub - KitwareMedical/SlicerCustomAppTemplate: Template to be used as a starting point for creating a custom 3D Slicer application) and successfully built a custom Slicer. The built executable worked correctly. After confirming this, I attempted to start coding for actual program development, but it seems that the IntelliSense in Visual Studio is not functioning as I expected.

From my understanding, the CMakeLists.txt files within SlicerCAT should configure the linkers for each library, and IntelliSense should read this, allowing the autocomplete mechanism to work well without me needing to make any additional settings.

However, for some reason I cannot ascertain, it only seems to support autocomplete for folders and files that actually exist in the project (root folder).

I am hoping to find someone who can inform me if I need to make specific modifications in the CMakeLists file to receive autocomplete assistance, if there are potential issues that could cause this problem even when the build is successful, or if I need to perform some additional actions.

I appreciate your help in advance.

Hello @msg4790. On Linux some IDEs require a file called compile_commands.json to be generated before having similar capabilities to IntelliSense. This can be generated by configuring the project with the variable CMAKE_EXPORT_COMPILE_COMMANDS set to ON (Note: some IDEs require this file to be in the source tree and not in the build tree, where it is naturally generated, I simply symlink the file, but some IDEs may be smart enough to pick it up from the build tree). Hopefully this can be helpful on Windows/VS too.

1 Like

Thank you for your response.

I’ve tried various methods, including the one you suggested, but with no luck.

Creating a custom medical app needs significant contributions, so I considered deriving from Slicer.

However, it appears that understanding the Slicer repository is too demanding compared to the features I aim to implement.

Given the deadlines for this project, I regretfully conclude that prioritizing Slicer is not feasible at the moment. However, I do hope to return to Slicer in the not so distant future, as I know that creating abstraction objects for every SOP Class myself is hell.

Thank you again.

1 Like