Skip to content

VinQut/sysmlv2-lsp

Repository files navigation

SysMLv2 LSP Server

A standalone LSP server for SysMLv2 and KerML files, wrapping the OMG SysML-v2-Pilot-Implementation parser. Usable with any LSP-compatible editor.

Download

Latest release: v0.1.0

sysmlv2-lsp-server.jar — pre-built fat JAR, ~30 MB. Requires Java 21+ (Eclipse Temurin).

No build needed — just download and point your editor at the JAR (see Quick Start below).

Features

LSP Feature Status Notes
Diagnostics Working Real-time validation with Standard Library resolution
Document Symbols Working Full symbol hierarchy (packages, parts, attributes)
Go to Definition Working Navigate to symbol definitions
Find References Working Find all usages of a symbol
Workspace Symbol Search Working Search symbols across entire workspace
Hover Working Metaclass, qualified name, type info, and doc comments
Completion Working Triggered on .
Go to Implementation Not supported Not applicable to SysML modeling
Call Hierarchy Not supported Not applicable to SysML modeling

Standard Library

The SysMLv2 Standard Library is fully loaded at startup. Implicit imports (Base, ScalarValues, Integer, String, Boolean, etc.) resolve correctly. A pre-computed .index.json provides O(1) namespace lookups, keeping startup under 30 seconds.

Quick Start

Prerequisites: Java 21+ (Eclipse Temurin)

Claude Code Plugin

Download the latest release JAR, then:

claude --plugin-dir /path/to/sysmlv2-lsp

Claude Code will automatically start the LSP server when you open .sysml or .kerml files. The server takes ~15-30 seconds to start (Java + Standard Library indexing).

OpenCode

Add the following to your opencode.json (project-level) or ~/.config/opencode/opencode.json (global), and adjust the JAR path:

{
  "$schema": "https://opencode.ai/config.json",
  "lsp": {
    "sysmlv2": {
      "command": ["java", "-Xmx2g", "-jar", "/absolute/path/to/sysmlv2-lsp-server.jar"],
      "extensions": [".sysml", ".kerml"]
    }
  }
}

See the OpenCode LSP documentation for additional options (env, initialization, disabled).

Standalone

java -Xmx2g -jar sysmlv2-lsp-server.jar

The server communicates via stdio (JSON-RPC/LSP). Add -trace for protocol message logging to stderr.

Building from Source

Only needed if you want to modify the server. End users can use the pre-built JAR.

Additional prerequisites: Maven 3.9+, Git with submodule support

# 1. Clone with submodules
git clone --recurse-submodules <repo-url>
cd sysmlv2-lsp

# 2. Build the Pilot Implementation (10-20 min on first run)
./scripts/build-pilot.sh

# 3. Extract JARs + Standard Library to server/lib/
./scripts/extract-jars.sh

# 4. Build the LSP server fat JAR
cd server && ./gradlew shadowJar

# Output: server/build/libs/sysmlv2-lsp-server.jar (~30 MB)

Configuration

Option Description
-Dsysml.library.skip=true Skip Standard Library loading (faster startup, no implicit imports)
-Dsysml.library.path=/path/to/sysml.library Use external library directory
SYSML_LIBRARY_PATH env var Alternative to system property
-trace Log JSON-RPC messages to stderr

Architecture

Claude Code  <── stdio/JSON-RPC ──>  sysmlv2-lsp-server.jar
                                       ├─ KerMLExpressions (.kermlexpr)
                                       ├─ KerML (.kerml)
                                       ├─ SysML (.sysml)
                                       ├─ Standard Library (.index.json)
                                       └─ Xtext 2.38.0 LSP framework

Three Xtext languages are registered via ServiceLoader (META-INF/services/org.eclipse.xtext.ISetup):

  1. KerMLExpressionsIdeSetup
  2. CustomKerMLIdeSetup (adds hover documentation provider)
  3. CustomSysMLIdeSetup (adds hover documentation provider)

Key implementation details:

  • Custom launcher captures System.out before redirecting to prevent JSON-RPC stream corruption from Xtext log messages
  • EMF SysMLPackage is explicitly registered (required in standalone mode; Eclipse uses plugin.xml extension points)
  • Guice ServerModule is overridden to inject SysMLWorkspaceConfigFactory for Standard Library workspace folder injection
  • PrecalculatedLibraryIndexProvider requires library files under a sysml.library/ directory path segment to locate .index.json
  • Shadow JAR merges META-INF/services files across all dependencies

License

MIT — see LICENSE.

The fat JAR bundles LGPL-3.0 (Pilot Implementation), EPL-2.0 (Xtext, LSP4J), and Apache-2.0 (Guice, Guava) dependencies. See NOTICE for details.

About

Language Server for SysMLv2 and KerML, wrapping the OMG Pilot Implementation parser.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors