sprotty-vscode-webview
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Sprotty Diagrams in VS Code Webviews

This library helps you to implement a VS Code webview that displays a Sprotty diagram. You can use sprotty-vscode to integrate such a webview in a VS Code extension.

Getting Started

The diagram itself is implemented with the Sprotty API. See the Sprotty Wiki, the states example and the Sprotty examples for reference.

The next step is to implement a subclass of SprottyStarter and instantiate it in your entry module as shown below.

export class ExampleSprottyStarter extends SprottyStarter {
    createContainer(diagramIdentifier: SprottyDiagramIdentifier) {
        return createExampleDiagramContainer(diagramIdentifier.clientId);
    }
}

new ExampleSprottyStarter().start();

Don't forget to call the start method, which initiates the communication to the host extension.

The function createExampleDiagramContainer should create an InversifyJS container with all necessary Sprotty configuration. The passed clientId should be used in the baseDiv and hiddenDiv ids in Sprotty's ViewerOptions.

In case you are connecting your diagram with a language server, e.g. using Langium, you should use SprottyLspEditStarter as superclass.

Dependencies (4)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i sprotty-vscode-webview

    Homepage

    sprotty.org/

    Weekly Downloads

    89

    Version

    1.0.0

    License

    (EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0)

    Unpacked Size

    169 kB

    Total Files

    84

    Last publish

    Collaborators

    • dennis.huebner
    • tortmayr
    • sprotty-owner
    • spoenemann
    • eclipse-sprotty-bot