Matlab support for IntelliJ
Matlab syntax highlighting plugin for JetBrains IDEs.
https://plugins.jetbrains.com/plugin/10941-matlab-support
Installation
- Open Settings | Plugins (Windows) or Preferences | Plugins (MacOS)
- Click Browse repositories...
- Type Matlab Support in search bar
- Click Install
Running matlab files from IDE
-
Right click on .m file in files tree.
-
Choose Run 'helloWorld.m'.
-
If you do it for the first time you'll see an error message telling you that interpreter is not specified.
- To fix it open Run | Edit configuration... choose created configuration and specify path to
matlab
executable.
Tip: you can specify path to any other program that runs .m files like Octave.
- To fix it open Run | Edit configuration... choose created configuration and specify path to
-
You can save generated run configuration so it will not be removed. To do it open Run | Edit configuration... choose the configuration and click Save icon.
Note: currently Program arguments
field in configuration is ignored.
Development
For easier development install Grammar-Kit plugin.
Follow these steps to start working on the plugin:
- Clone project and import it to IntelliJ IDEA as Gradle project.
- Run/Debug
runIde
Gradle task.
How to re-generate parser
After you made changes to bnf or flex files you need to generate new lexer/parser code:
- Generate Matlab lexers. Open MatlabLexer.flex and click Run JFlex Generator from context menu, do the same for SingleQuoteStringLexer.flex.
- Generate Matlab parser. Open Matlab.bnf and run Generate Parser Code from context menu.
If you have any issue with setting up development environment then please create an issue.
The project is written in Kotlin. It's pretty easy to learn. To get started you may quickly look through Basic Syntax and Classes and Inheritance.
Contributions in Java are also welcomed.
To build a jar with Matlab Plugin run buildPlugin
Gradle task.
Tips for plugin developers
- View PSI Structure.
When you start IDEA with
runIde
Gradle task you may open a matlab file in the IDE and run View PSI Structure of Current File.. action.