Using Sublime Text with JUCE

I want to venture away from the Projucer for editing source code. Mainly, I just want to have better syntax highlighting, and I really want suggestions/auto-complete.

When I worked at a tech company, all the wizards there used Sublime Text, and it’s free and available for Linux, so I guess that’s what I’m gonna use now!

Syntax highlighting is great. But when typing something like Slider.setValue(); it was only able to suggest Slider.getValue(); as that was the only option previously existing in the rest of the source code file. That’s all it knows about.

I’m guessing it needs to become aware of the JUCE library, but how do I do that?

I’ve tried adding the JUCE folder to the project by using Add folder to project...?

But that doesn’t do it.

You’ve been using the Projucer for editing source code?! No comment.

But seriously, have you considered using a proper IDE instead of a text editor? It really does make life easier. CLion is a nice IDE and available on Linux. And the Projucer will export CLion projects for you. CodeLite is another one that I got a lot of usage out of. You can configure that one to work with Linux makefiles. But all IDEs will provide syntax highlighting and code completion more or less out of the box. Sublime is a nice editor. So is Visual Studio code, and Atom, but I never use them for JUCE projects. Life is too short.

1 Like

Well, sometimes you have no choice. I do a lot of programming for embedded platforms under Linux, so I edit all (final) code for it in the Projucer. Settings of all external dependencies, libraries, toolchains etc. in any IDE is a nightmare - at least for me. And from this point of view the Projucer is a good tool and I wish it has some, even limited to the JUCE modules, suggestion system (but I understand it’s not so important feature for most users).

So I played around with Clion, and I’m sure it’s great, but it ran terribly slow on my system and it’s very not free, so there goes that. I’m gonna try and get comfortable in Code:Blocks (I actually installed a ‘sublime’ theme and that’s already much better) There is some kind of auto complete, but it doesn’t seem to recognise my own instances of JUCE classes but it does recognise the JUCE library otherwise. Not to worry, I’ll figure it out as I go. Thanks all.

My reply is not about sublime text but about making autocomplete work somehow in Linux.
I had this problem yesterday, meaning it only autocompleted items that were already in the document and not recognizing the actual library. I solved it today. Attached is an image.

I use Ubuntu. And I use the Linux Makefile build. This works now in Visual Code.

It also nicely shows documentation of classes and types, when you hover mouse over them. Especially classes. This obviously helps a lot with speed of development.
What I did was 2 things:
a) install C++ extension by Microsoft
b) I had to setup Projucer to recognize the path of each libraries because some were corrupt/invalid and shown with red error for the Linux Makefile build, plus have set all to “copy to local” just to be sure. Then I saved the projucer project and made a rescan of the modules paths too. Not sure if the rescan had any effect. After saving the projucer build, I think it rewrites the “JuceLibraryCode” folder in your project , which causes intellisense to work. This is an assumption but I think a safe one.

I don’t think that you need to “copy to local”. Rather, just update the C/C++ configurations file with the includes you need. Here is a screenshot of what worked for me on Mac. I haven’t tried it on Linux yet, but it seems like it should work the same way. Good luck!

You also may want to take a look at this - https://code.visualstudio.com/docs/cpp/config-clang-mac

1 Like