MCPcopy Index your code
hub / github.com/eclipse-sprotty/sprotty-vscode

github.com/eclipse-sprotty/sprotty-vscode @v1.1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.1.0 ↗ · + Follow
280 symbols 573 edges 60 files 19 documented · 7% updated 16d agov1.1.0 · 2025-07-18★ 621 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Gitpod Ready-to-Code

sprotty-vscode

This repository contains the glue code to integrate Sprotty diagrams - with or without a language server - in VSCode extensions.

Also contains an example extension for a domain-specific language for statemachines. The example is also available as States Example from the VS Code Marketplace.

Screenshot

Features

  • running Sprotty diagrams in VS Code webviews,
  • SVG export (ALT-E), animated center selection (ALT-C) and fit to screen (ALT-F) actions,
  • interaction with Sprotty-enhanced language servers to automatically synchronize diagrams with language artifacts.

Architecture

In VS Code, extensions can contribute new UI components using a webview. Webviews communicate with the extension using the vscode-messenger library. The WebviewPanelManager uses this to send and receive Sprotty Actions to and from a WebviewEndpoint. The latter runs a webpacked bundle.js that contains the Sprotty diagram code.

Architecture Diagram

If your extension provides a language, you can include a Sprotty-enhanced language server to get fully synchronized diagrams for your language artifacts. The SprottyLspVscodeExtension acts as a relay between the language server and a SprottyLanguageWebview, and intercepts actions/LSP messages that require to interact with the VS Code workbench.

Contents

The repo is structured as follows - examples: an example Sprotty visualization using a Langium-based Language Server. - packages/sprotty-vscode: library code for the VSCode extension. - packages/sprotty-vscode-protocol: common protocol classes for the communication between the extension and the webview. - packages/sprotty-vscode-webview: library code for the script that is run in the webview.

Development

Compile the library code and the examples:

yarn

If you also want to use the older Xtext-based example, you need to run this command before yarn:

./examples/states-xtext/language-server/gradlew -p examples/states-xtext/language-server/ build

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 117
Class 71
Function 63
Interface 29

Languages

TypeScript100%

Modules by API surface

packages/sprotty-vscode/src/webview-endpoint.ts22 symbols
packages/sprotty-vscode/src/sprotty-editor-provider.ts19 symbols
examples/states-langium/language-server/src/generated/ast.ts14 symbols
packages/sprotty-vscode/src/sprotty-view-provider.ts13 symbols
packages/sprotty-vscode-webview/src/lsp/editing/code-action-popup-palette.ts13 symbols
packages/sprotty-vscode/src/webview-panel-manager.ts12 symbols
packages/sprotty-vscode-webview/src/lsp/editing/delete-with-workspace-edit.ts10 symbols
examples/states-langium/webview/src/model.ts10 symbols
packages/sprotty-vscode/src/webview-utils.ts8 symbols
packages/sprotty-vscode/src/lsp/lsp-webview-panel-manager.ts8 symbols
packages/sprotty-vscode/src/lsp/lsp-sprotty-view-provider.ts8 symbols
packages/sprotty-vscode/src/lsp/lsp-sprotty-editor-provider.ts8 symbols

For agents

$ claude mcp add sprotty-vscode \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page