Our first release of the year is here! With MPS 2019.1, we haven’t focused on any specific subsystem in particular, but rather on multiple parts of the product that came from the needs of our clients and community. Some of the features were made possible by customers who tasked us with implementing them for their own specific needs; for more information about how we work with customers, please see our Service page.
Custom style and priority of completion items (Client Sponsored)
Language designers can set the style and priority for the items in the completion menu.
In order to do so, the language designer should create a Completion Styling root in the editor aspect of the language and stylers – statements that define the type of style.
To specify the style of a completion menu item, the language designer should first specify the item.
We currently provide two possible selectors of the completion items:
1) Items which modify instances of a specific concept. This selector selects items which appear in the completion menu when the user puts the caret on the node of the concept (or its properties, references, or children) and presses Ctrl+Space.
2) Items which create instances of a specific concept. These are mainly substituted actions. For example, when a user selects the ReturnStatement which is in the StatementList and presses Ctrl+Space, items in the completion menu items create instances of the Statement and replaces the ReturnStatement with these instances. So the selector for actions creating instances of a Statement will select these items.
It is important that one item can be selected by many selectors, for example, in the situation above there are several selectors which will match one completion item:
1) For actions creating instances of a Statement (because the item will replace the current node with another Statement)
2) For actions modifying instances of a Statement (because the current node is a ReturnStatement which is also a Statement)
3) For actions modifying instances of StatementList:statement (because the item will paste a new node into the statement role of the parent StatementList)
So you should put a preference on the most specific selector possible.
For example selector of actions modifying instances of BaseConcept is the least specific selector and will affect all the completion menu items
Once the selector matches the menu item, the language designer can customize its style. There is a style object for that.
It is currently possible to:
- Make an item’s font bold
- Make an item’s font italic
- Strikeout an item’s text (useful for deprecating concepts)
- Set an items’ background and text color
- Hide an item
- Set an item’s priority
- Update an item’s description text
Note that all the styles accumulate: if at least one styler is set as bold/italic/hide, the item will also be bold/italic/hidden. If the background or text colors conflict, the one set first will be used.
The priorities are used to sort the items, the higher-priority items are used by the stylers.
Items are sorted by priorities first and then by the level of matching to the user’s text. Currently, there is no way to override this level.
There are several parameters that a language designer can use, and they are all stored in the itemInformation parameter:
- matchingText – the text which appears on the left of the item. This text is used to filter the items when a user types their text in the completion menu.
- descriptionText – the text which appears on the right of the item.
- parameterObject – some of the items are parameterized with this object. For example, items which change the node’s reference are parameterized with the target of the reference which they will set when they are executed.
- outputConcept – some actions, like substitute actions, create new nodes, the output concept is the concept of the new node.
The most notable examples of stylers in the baseLanguage are:
1) LastReturnStatementStyling which makes the return item bold and sets its priority to non-zero if it is last in the current statement list.
2) VariableReferencePriority which sets an item’s priority to non-zero if the item references the variable declaration.
This feature is experimental and its design may undergo big changes in the future. Your feedback regarding this feature will be very appreciated and will really help us to improve it.
If you want to turn the feature off, use Settings>Editor>General>Use completion styling.
Support for automatic type inference introduced for new VAR macro
VAR macro now supports multiple variable declarations per macro in the Generator language. The type is deduced from the declaration query unless it is overridden.
Use MPS plugins from the migration ant task (Client Sponsored)
Now, if a plugin is needed for a project to migrate, this can be specified in the <migrate> ant task. The corresponding plugin will be enabled, together with its dependencies. We’ve also integrated this feature into 2018.3.5 following a client support request.
Plugin deploy support in the “run code from solution” build script instruction (Client Sponsored)
The “run code from solution” instruction allows you to enable plugins in the MPS instance that will run the code. The dependencies of the plugin will be included. This feature was also integrated into 2018.3.5 following a client support request.
Create your custom UI theme
Add a touch of color to your day! The IntelliJ Platform has just introduced this cool feature, and since MPS is based on it, now you can customize the UI themes for your IDE too. Import the new predefined themes as plugins or create your own from scratch with IntelliJ IDEA. Try our new Cyan Light Theme and Dark Purple Theme.
Sorting in ProjectPane (Client Sponsored)
We’ve added TreeNodeSortService to manage ChildComparatorProvider contributions that gives you full control over the MPSTreeNode children in the ProjectPane tree. Clients will now register/unregister providers from their plugin’s application or project parts.
An indication of incoming and outgoing commits
The IDE now indicates if the incoming and outgoing commits are available for individual branches in the Branches popup. Simply enable the new ‘Mark Branches that have incoming/outgoing commits in the Branches popup’ option in Preferences/Settings | Version Control | Git.
JUnit run configuration now accepts plugins to deploy
Similar to an MPS Instance run configuration, now you are able to provide a list of IntelliJ IDEA plugins to be deployed on test execution. The ‘before launch’ task, ‘Assemble Plugins’, is available in JUnit run configuration as well. It automatically builds the plugins being deployed and copies the artifacts to the settings directory.
Static Methods in baseLanguage Interfaces
MPS now allows you to create static methods in interfaces.
Goodbye Confluence, hello Help Center!
Since forever, Confluence has been the home of the MPS documentation. Now it’s time to grow up and move out to our own place. We are migrating all the documentation to our Help Center; the User guide and Fast Track Tutorial are already accessible there. Expect more documentation improvements in future releases.
Stub methods signature
The return type of the method was removed from the MPS node IDs created in Java stub models. From now on, the true method signature defined by the Java language specification is used to identify methods. You don’t have to resave all models, referencing a method from sub model, if the return type was changed in a new version of the library. Automatic migration will resave all MPS models and correct all existing references to stub model methods.
New meaning for the ‘Compile in MPS’ checkbox
If the ‘Compile in MPS’ checkbox in module properties is not selected, this no longer implies there’s a connected IntelliJ IDEA instance to perform code compilation. The checkbox can be understood as “either compile in MPS or do not compile at all”.
MPS shows aggregated languages automatically
Structure aspects now manifest the languages they incorporate by aggregation (i.e. using a foreign concept in a child role). It’s no longer necessary to import such languages explicitly into a model that uses an aggregated language will be automatically used while editing.
Have a nice day!
Your JetBrains MPS Team
The Drive to Develop