Some of you might remember my first post about this about a year ago. A lot happened since then because I have worked hard to constantly improve the plugin and add new features. Last month, I rolled out version 0.3.2 of the Mathematica Plugin for IntelliJ IDEA, which comes with many major improvements and new features.
I cannot describe everything here, but I'm about to finished a very extensive blog article, which covers all things you need to know in great detail. Unfortunately, I will need some more time to polish this article and time is currently a scarce resource, but I promise it won't be long anymore. Until then, feel free to read the current documentation or ask me or others in the dedicated chat-room.
First of all, starting with this version we will have a Structure View for your code files. This will show you all defined functions, messages, attributes, options etc. of your package in a tree view like the one below in the image.
The entries in this view can be grouped by type (e.g. put all option assignments together) or by name (put messages, options and definitions of a single function together). You can sort them to your needs and you can quickly jump from the structure view to the appropriate code place and vice versa. Therefore, the structure view gives you a compact overview of all definitions in your code and lets you easily navigate through even several thousand lines of code.
The next big feature is called Live Templates. While the structure view was on the could-you-pretty-pretty-please-implement-list of one of my precious plugin testers, the live templates were on the top of my wish-list. With live templates you can create larger code constructs by typing abbreviations and expanding them directly while you code. How does this work? For most of the often used functions like Module
, Block
, Table
, Nest
etc you just type the name in lowercase without vowels in the editor, e.g. nst
, and then you press Tab and it will be expanded to Nest[func, expr, n]
, where the func
parameter is selected and you can directly start typing. To see the complete list of possible live templates just press Ctrl+j or go to Settings > Live Templates > Mathematica.
The last new feature I want to show works almost hand in hand with Live Templates: Surround code with other code. Let's say you have written some code and you decide you need to put this into a Module, then you do nothing more than selecting the appropriate region of code and press Ctrl+Alt+T and a window will popup. There you can select your Surrounder; in your case Module
(which has the shortcut m). The Surround-With-feature is extremely convenient, since it easily lets you wrap any expression with an arbitrary function. Therefore, creating myFunc[very+long+nast+expression]
from very+long+nasty+expression
is only one key-press away.
As for the "many bugfixes and improvements" let me name some of the things I have worked on:
I have greatly improved the speed of the code highlighter and analyser. This might not be of interest to people who keep their packages of reasonable size, but let me tell you that even files with about 17.000 lines of code can be analysed in a matter of seconds. Before you ask who writes so many lines of code into one file: have a look at the Combinatorica.m
package in your AddOns
path.
I have created a brand new set of icons. I needed design some additional icons for the Structure View anyway and in the process I did some unification for the used Mathematica spikey icon too.
I have improved Smart Enter in situations where you use it to finish up expressions. Try this Module[{i=1},] with the cursor after the 1 and then press Ctrl+Shift+Enter repeatedly and see what happens.
I have fixed a bug regarding the "show documentation" feature. Now you can (again) press Ctrl+Q for the docs while you are navigating the list of autocompletion entries. Try to press Ctrl+Space to make the autocompletion popup appear, then Ctrl+Q and then navigate downwards the list of entries.
I have almost completely rewritten the algorithm to search for places where values are assigned to a symbol. Now, definitions for the symbol Bar
are even found in situations like Times[Bar, Foo2] ^:= myTimes[Bar, Foo];
or Format[Bar[x_, y_]] := MatrixForm[{{x}, {y}}];
or SetAttributes[Bar, {Listable}];
or SetDelayed[Bar, Blub];
. Of course, you will be able to see and navigate all those kinds of definitions in the Structure View.
I have introduced stringified symbols. What is this? Well, in situations like when a line starts with <<
, which is used to load packages, the code that comes after the <<
is not interpreted as usual Mathematica syntax. Consider << A/B.m
and you will easily see that this is not a division and a dot-product, but a path to a package. These exeptions to the normal Mathematica syntax happen at some other places too and all you have to know is that they are now handled correctly.