How to get CLion's linter to work in juce_*.cpp files?

I am working on a JUCE tutorial and would like to show a piece of JUCE source code: in this instance, juce::LookAndFeel_V4::drawRotarySlider() implementation.

Unfortunately, CLion’s linter does not work for JUCE implementation files. Here’s how it looks for me on macOS:

I’ve tried switching the target, but AU, VST3, and Standalone all give the same result: lack of proper coloring and no way to navigate around using Cmd + Click or “Go to declaration”.

I wonder if that’s an inherent feature of JUCE modules or if anyone has managed to fix it. I realize that this is a rare use case, but wouldn’t it be nice to have proper linting of JUCE modules’ source code? :slight_smile:

I am using CLion 2025.1.3

See FR: Add explicit includes to JUCE modules

It’s usually that CLion doesn’t know where the definitions for JUCE symbols are due to the lack of explicit includes.

IME, you shouldn’t see these issues when using CMake as it’s aware of where all the library sources are.

1 Like

Thanks for the reply, that’s the kind of thread I was looking for :slight_smile:

Hmm, I need to find a way to tell that to my CLion! :smiley:

I think this depends on the module to some extent. I see the same thing here; however, files that are included earlier on in juce_gui_basics.cpp (all the native macOS files) seem to get indexed correctly. Some files that are included later on (TopLevelWindow.cpp, TooltipWindow.cpp) also get indexed correctly. It seems as though there’s something that’s throwing off the indexing for some files in the middle, including the LookAndFeel sources, but at the moment I’m not sure what that could be.

1 Like

Ah, yes, it’s the same for me too. My initial guess would be the size of the file: juce_Silder.cpp is over 1800 lines.

Update: After opening juce_gui_basics.cpp and randomly navigating to some other juce_gui_basics sources, linting started working :man_facepalming:

I remember vscode used to do something similar before the CMake support improved.

1 Like

I’m pretty sure it has to do with CLion Nova lack of Objective-C++ support. If I remove the main .mm file from my custom module, the linter starts working again.

Unfortunately, it’s not on JetBrains’ roadmap but you can vote for the feature request here.

1 Like

Interesting!