CMake simple highlighter

Compatible with: IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion GoLand DataGrip Rider MPS Android Studio
Apr 16, 2018
4 111
Plugin for CMake syntax highlight/navigation support.
- It provides syntax highlight and variables navigation/renaming (*see Notes) for IntelliJ IDEA and Android Studio(till 3.2).
- Extend existed highlighting in CLion and Android Studio(from 3.2).

Vote! for new functionality (write it in Note) and support the developer Paypal.me/AChapialiou :
- variable's scope of visibility for navigation/renaming.
- variables navigation/renaming in CLion and Android Studio(from 3.2).
- ENV variables navigation/renaming.
- function's declaration and references navigation/renaming.
- Other ... (just write in Note your needs!)

Download plugin

Recent change notes

0.2.2 - Fixed compatibility for upcoming Android Studio 3.2 (with restricted functionality as for CLion). As a side effect the Plugin become open for all IntelliJ Platform's IDEs.
0.2.1 - Fixed Android Studio compatibility issue.
0.2.0 - New lexer-parser-annotator stack used:
  * Navigation and renaming for variable's declarations/references(*see Notes: only for IntelliJ IDEA and Android Studio( till 3.2) yet).
  * Additional highlighting: variable's declarations and properties/operators.
  * Colors setting also available in CLion.
0.1.0 - CLion support added.
0.0.3 - BraceMatcher added.
0.0.2 - Fix bug of not evaluating escaped escape symbol `\\` inside quoted argument.
0.0.1 - In this version syntax highlighting is provided.

General usage instructions

Plugin for CMake syntax highlight/navigation support.

- It provides syntax highlight and variables navigation/renaming (*see Notes) for
IntelliJ IDEA and
Android Studio.

- Extend existed highlighting in
CLion.



The main goal was to make CMakeLists.txt files more readable in Android Studio. It is my play project to study IntelliJ language support. Please see JetBrains manual for more details. Work is still in progress.

Plugin is inspired and based on CMaker by Aliaksandr Dubrouski

CMake Syntax from cmake.org is mostly implemented.


Notes for 0.2.0

Variable declaration and usage panels (IDEA/Android studio only: Ctrl+B, Alt+F7, Ctrl+Click, etc.) show all visible mentions of the variable name in ALL Project's cmake files. Scope principles (function, directory, etc.) not yet implemented. Use it for guidance only not for determining variable visibility. Variable reference's specific case inside IF and WHILE conditions implemented.

Navigation between variable's declarations/references in CLion is not implemented. Might be implemented in future releases.

ENV variables navigation/renaming is not implemented yet. Nevertheless ENV variables highlighting works.

Variable's rename refactoring (Shift+F6) works fine for variables with single declaration. For multi declared (re-declared, amended) variables rename refactoring works only from variable declaration side (i.e. caret should be on variable declaration, not reference) and will change all visible references and only current declaration. Use with caution, it looks for me like a bug (feature?) of IDEA.

For
CLion and from version 0.2.0 for
IntelliJ IDEA CE and
Android Studio: Commands, Variables, Property and Operator was taken from official [cmake.org](https://cmake.org/cmake/help/latest/index.html) manuals.

For CLion the plugin just adds annotator on top of CLion's builtin CMake support. So all original CLion features (and bugs) works.

Till version 0.2.0
IntelliJ IDEA CE and
Android Studio: Commands, Variables, Property and Operator was taken from [vim CMake support pluging](https://raw.githubusercontent.com/nickhutchinson/vim-cmake-syntax/master/syntax/cmake.vim)

Till version 0.2.0
IntelliJ IDEA CE and
Android Studio there are few known syntax highlights bugs, mostly around `$` symbol, because it's used to recognise Variable references in arguments. But those bugs could be reproduced mostly on synthetic tests while real `CMakeLists.txt` files shown correctly.

In case you don't need such a detailed highlight (i.e. it looks too motley) you can always change colors at plugin settings.