Section 1 - IntelliJ IDEA integration
Section 2 - New Build Language
The reference representation can now vary depending on the reference location, as it is in many existing textual languages. It allows languages to support the notion of qualified reference when simple name of the target element is not enough. The new API requires developers to provide the referenceText value as a part of the Scope implementation (see jetbrains.mps.scope.Scope). All references in BaseLanguage now support java-style resolving. Also, in case of broken references the referenceText serves as a hint to the developer to fix it easily.
TODO: a screen-shot ?Image Added
Custom persistence for MPS models through stubs
With the improved jetbrains.mps.lang.stubs language, which now supports write as well as read operations, it is now possible to declare a custom stubs model manager that supports model saving functionality. Using this extension point you can teach MPS how to interoperate with any custom persistence syntax. You can load and save your models from and into a format that fits your needs best. Read more at the Custom Persistence Stubs and custom persistence page.
One of very effective ways to maintain high quality of code in MPS is the instant on-the-fly code analysis that highlights errors, warnings or potential problems directly in code. Just like with other code quality reporting tools, it is essential for the user to be able to mark false positives so that they are not reported repeatedly.
MPS now provides the language developers with a customizable way to suppress errors in their languages. This functionality was used to implement Suppress Errors intention for BaseLanguage:
MPS now enables the developers to suppress the reported problems directly in the editor (and in the model checker).
If a node is an instance of a concept, which implements the ISuppressErrors interface, all issues on this node and all its children won't be shown. For example, comments in BaseLanguage implement ISupressErrors. It is also possible to define child roles, in which issues should be suppressed, by overriding the boolean method suppress(node<> child) of the ISupressErrors interface.
Additionally, if a node has an attribute of a concept that implements ISuppressErrors, issues in such node will be suppressed too. There is a convenience default implementation of an ISuppressErrors node attribute called SuppressErrorsAttribute. It can be applied to only those nodes that are instances of ICanSuppressErrors.
One place where this feature is also useful are the generators, since type errors, for example, are sometimes unavoidable in the templates.
In order to make the structure of MPS core languages more consistent and clear, the Refactoring language has been changed considerably. Several new and easy-to-use constructs have been added and parts of the functionality was deprecated and moved into the Actions language.
The UI for retrieving the refactoring parameters has been removed from the refactoring language. Choosers for parameters are no longer called, it is not allowed to show UI in
ask boolean) and keystroke has no effect. All this functionality should be moved to an action corresponding to the refactoring.
The following constructs have been added to the refactoring language. These new constructs are intended to to be used from code, typically from within the actions:
is applicable refactoring<
returns true if the refactoring target corresponds to the current target (type, single/multiple) and applicable as in refactoring
isApplicablemethod, and there is no refactoring that overrides current refactoring for this target.
executes the refactoring for the target with parameters
create a refactoring context for the refactoring, target and fill parameters in context, this context then can be used for refactoring execution or for further work with parameters; UI is not shown during this call
It is necessary to manually migrate existing user refactorings. The migration consists of several steps:
- create a UI action for the refactoring
- copy the caption, create context parameters
- add a refactoring keystroke with the newly created action to KeymapChangesDeclaration
- create ActionGroupDeclaration for the refactoring that modifies the jetbrains.mps.ide.actions.NodeRefactoring action group at the default position
- add an
isApplicableclause to the action created; usually it is just
is applicable refactoring< >
- add an
executeclause to the action created; all the parameter preparations that were in
initof the refactoring should be moved here; at the end it is necessary to execute the refactoring with the prepared parameters (with
execute refactoring< >
- remove all parameter preparation code from
initof the refactoring, they are now prepared before the entry to
init; you can still validate parameters and return false if the validation fails
Section 4 - IDE enhancements
The Dependencies Analyzer can analyze and report dependencies among modules or models. It can be called from the main menu or from the popup menu of modules/models:
Image Removed Image Removed Image Removed
The interactive report, shown in a panel at the bottom, allows the user to view usages of modules by other modules. The panel on the right side displays modules and models dependent on the module selected in the left-hand side list.
Unlike the Module Dependencies Tool, which is described below and which simply visualizes the dependency information specified in model properties, the Analyzer checks the actual code and performs dependency analysis. It detects and highlights the elements that you really depend onyour code really refers to.
Module Dependencies Tool
The Module Dependencies Tool allows the user to overview all the dependencies and used languages of a module or a set of modules, to detect potential cyclic dependencies as well as to see detailed paths that form the dependencies. The tool can be invoked from the project pane when one or more modules are selected.
Module Dependency Tool shows all transitive dependencies of the modules in the left panel. Optionally it can also display all directly or indirectly used languages. It is possible to expand any dependency node and get all dependencies of the expanded node as children. These will again be transitive dependencies, but this time for the expanded node.
Select one or more of the dependency nodes in the left panel. The right panel will show paths to each of the selected modules from its "parent" module. You can see a brief explanation of each relation between modules in the right tree. The types of dependencies can be one of: depends on, uses language, exports runtime, uses devkit, etc. For convinience the name of the target dependent module is shown in bold.
There are two types of dependency paths: Dependency and Used Language. When you select a module in the Used Language folder in the left tree, the right tree shows only the dependency paths that introduce the used language relation for the given module. To show "ordinary" dependencies on a language module, you should select it outside of the Used Languages folder (e.g. the jetbrains.mps.lang.core language in the picture below). It is also possible to select multiple nodes (e.g. the same language dependency both inside and outside of the Used Language folder). In that case you get a union of results for both paths.
When you are using a language that comes with its own libraries, those libraries are typically not needed to compile your project. It is the runtime when the libraries must be around for your code to work. For tracking runtime dependencies in addition to the "compile-time visible" ones, you should check the Runtime option in the toolbar. The runtime dependencies are marked with a "(runtime)" comment.
The default order for dependency paths is by their length starting from the shortest. However, there are paths that cannot be shown - paths that have the same tail part as one of the already shown path. It is still possible to display all such paths in the right tree with the "Show all paths" option. For these only the starting (distinct) part of the path is shown, while the symbols "... -->" mean that there is already a path shown in the tree somewhere above that describes the rest of the dependency path. You can follow the path by double-clicking its last element.
The modules in the left tree that participate in dependency cycles are shown in red color. It is possible to see paths forming the cycle by selecting the module dependency that refers to the parent or, for the user convinience, by using the popup menu:
For some types of dependencies the pop-up menu offers the possibility to invoke convenience actions such as Show Usages or Safe Delete. For the "depends on" dependencies (those without re-export) Dependencies Analyzer will be invoked for the Show Usages action.
An example of using the SuppressErrorsAttribute attribute and the corresponding intention.
There is an error in editor:
BaseLanguage Statement implements ICanSuppressErrors, so the user can apply the highlighted intention here:
Now the error isn't highlighted any longer, but there is a newly added cross icon in the left pane. The SuppressErrorsAttribute can be removed either by pressing that cross or by applying the corresponding intention
Showing the current status of Saving Transient Models in the status bar
A button in the status bar allows the user to enable and disable saving of transient models with one click.
If transient nodels saving is enabled, this button shows a notification popup when generation starts.
The popup notification can be disabled in Settings -> IDE Settings -> Notifications -> Saving Transient Models Is On.
More reliable merge conflict handling with the MPS merge driver:
- Automatic merge of project and .msd/.mpl files.
- The merge driver tries to leave the models in the working directory in a readable state during conflict resolution
- Conflicted models cannot be opened from project tree in a normal way. When you first try to open a conflicted model, the merge dialog for this model will show up.
In order to make MPS more modular, the debugger API and the Java debugger itself were moved into separate MPS plugins. This allows the user to completely turn the functionality off when not needed. A migration script to upgrade code to the new debugger API has been included in the MPS 2.5 migration wizard. Additionally, a migration script named "Fix references to debugger classes" is available for manual execution.
New debugger features introduced in MPS 2.5:
- Cell-based highlighting in tables.
- Toolbar with stepping actions in the Debugger Tool.
Save Transient Models indicator
It's not a secret that you can save transient models during code generation for debugging purposes. In MPS 2.5 you can switch now on/off saving of transient models just by clicking onto a button in the status bar:
In MPS 2.0 the Merge Driver has been introduced to resolve merge conflicts inside MPS-specific files. In MPS 2.5 the Merge driver has been modified in order to handle merge conflicts in a more reliable way:
- Merge driver is now handling .msd/.mpl files in addition to the model files
- Model files are always kept in a valid state, even during merge conflict resolution
- Merge dialog would appear each time you try to open a model with conflicts
Using MPS projectional editing functionality and improved debugger support it is possible to implement cell-based highlighting of DSL code instead of the usual single-line highlighting typical for text-based debuggers:
In addition to changes in the general debugger framework a number of improvements were implemented for Java-specific debugging
- "Copy value" popup menu action for inspected variables in the variables view
- Special highligting for incorrectly placed breakpoints
- Use Alt+F8 to copy selected code from the editor into the Evaluate window
- High-level (Domain-specific) types and variable names are calculated for variables in the evaluation and watches windows. Low-level
- (java) types are shown in brackets.
- isApplicable function is available in the breakpoints creators.
Comfortable way to run MPS from MPS
A Run Configuration, which starts another instance of MPS from MPS, can now automatically open a selected project on start. You can either choose an arbitrary project path or open the current project that is already open in the current MPS instance. In the Latter case, the project file is copied into a temporary directory to avoid collisions between the two running instances.
Section 5 - Other
New Productivity Guide