syntax highlighting for non-compiled code

I work on cross platform projects all the time, a lot of time using Qt but sometimes just raw C++.  The problem here is I don't get any syntax highlighting when I'm working on code that isn't compiled on the native system.

So the scenario, I write the code on Linux.  So my sections that are conditionally compiled for Windows or OSX do not get any syntax highlighting.  I can deal with no code checking, error highlighting, etc.  But I've come to rely on colors for reading code.  It make it quite hard to read with it.

Anyone know a way to get syntax highlighting on code that is being excluded by the compiler on your current system?

3 comments
Comment actions Permalink

Hi Mike.

Do you have a CMake version for the project?
So your problems can be there if CLion doesn’t get the project structure very well. It takes all the information (about sources, header files, include paths, libraries used, standards, compiler flags, etc.) from CMake files.

0
Comment actions Permalink

Yea I'm using cmake_minimum_required(VERSION 3.2).

The problem is that I'm working on linux and the code is windows specific so it is not part of the conditional compile.  It would be protected under a `if (WIN32) ...` section in the cmake.  So I'm thinking that the parser to highlight keywords and such isn't parsing it because it isn't part of the build.

A simple way to see this behavior and test it is:

```
int main()
{
   int thisIsHighlighted = 10;

#ifdef SOMETHING_NOT_DEFINED
   const char *thisIsNotHighlighted = "bummer";
#endif
}
```

Edit: looks like markdown doesn't work here.  Don't know how to do code blocks on this forum, lol.

0
Comment actions Permalink

Hi Mike!

I've created an issue in our tracker. Feel free to comment or upvote there.

0

Please sign in to leave a comment.