Child pages
  • What's new in MPS 2.5 M1

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Now the error isn't highlighted, but there is a cross icon in the left pane. SuppressErrorsAttribute can be removed either by pressing on that cross or by applying corresponding intention

Extensions support

Extensions provide a possibility to extend certain aspects of a solution or a language, which are not covered by the standard language aspects and the plugin mechanisms.

Support for extensions exists in

  • languages
  • plugin solutions

Quick howto

  1. Create an extension point
  2. Create one or more extensions
  3. Both must be in the plugin model
    1. Each extension must provide a get method, returning an object
    2. Each extension may opt to receive activate/deactivate notifications
    3. An extension may declare fields, just like class

Extension language

The language jetbrains.mps.lang.extension declares concepts necessary for building extensions.

Extension point

ExtensionPoint concept represents an extension point. The extension object type must be specified as a parameter.
Image Added

Extension

Extension concept is used to create a concrete extension.
Image Added

Accessing extension point

An extension point can be accessed by reference using extension point expression.
Image Added

Accessing extension objects

An extension point includes a way to access all objects provided by its extensions.
Image Added

Note
titleBe Careful

Objects returned by the extensions have transient nature: they may become obsolete as soon as a module reloading event happens. It is not recommended to e.g. cache these objects, instead is it better to get a fresh copy each time.

Java API

Code Block
java
java

public interface Extension<T> {

  String getExtensionPointId ();

  T get ();

  void activate ();

  void deactivate ();
}

public class ExtensionPoint<T> {

  public ExtensionPoint (String id, Class<T> type) { ... }

  public Class<T> getType () { ... }

  public Iterable<Extension<T>> getExtensions () { ... }

  public Iterable<T> getObjects () { ... }

  public String getNamespace () { ... }

  public String getId () { ... }

}

Extension points and extensions are managed by the ExtensionRegistry core component.