Skip to content

umple/umple-lsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

322 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Umple LSP

A Language Server Protocol implementation for the Umple modeling language. Provides IDE features for .ump files across multiple editors.

πŸ“š Contributors / future maintainers β€” start at wiki/README.md. The wiki has the full handoff documentation: architecture, dev setup, all four publishing pipelines (npm / VS Code / Zed / Neovim), CI automation, the AI-collab review protocol, and known gotchas.

Features

  • Diagnostics - Real-time error and warning detection via the Umple compiler
  • Go-to-definition - Jump to classes, interfaces, traits, enums, attributes, methods, state machines, states, associations, mixsets, and requirements. Container-scoped resolution prevents false cross-class jumps. Includes reused standalone statemachine fallback.
  • Find references - Semantic reference search with state-path disambiguation, inheritance chain walking, and shared-state equivalence for reused standalone statemachines
  • Rename - Safe rename across all references (same pipeline as find-references)
  • Hover - Contextual information for symbols with markdown formatting
  • Code completion - Context-aware keyword and symbol suggestions
  • Document symbols - Hierarchical outline of classes, state machines, states, attributes, methods
  • Formatting - AST-driven indent correction, arrow spacing, blank-line normalization, compact state expansion
  • Syntax highlighting - Tree-sitter grammar for accurate highlighting
  • Cross-file support - Transitive use statement resolution and cross-file diagnostics
  • Import error reporting - Errors in imported files shown on the use statement line
  • Diagram navigation - Custom LSP requests (umple/resolveStateLocation, umple/resolveTransitionLocation) for click-to-select in UML diagrams

Umple Grammar Coverage

The table below shows the LSP's support for Umple language features, based on the Umple Grammar. Priority: ** = high, * = lower.

Feature Priority Status Notes
Directive (top level)
generate * βœ… Language names, path, --override, -s suboption
suboption * ⚠️ Syntax works; specific suboption names not enumerated
filter * βœ… Named/unnamed, numeric names, glob patterns, hops; class completions in include; go-to-def for plain names
useStatement ** βœ… File completions and go-to-def; lib: paths parse cleanly (runtime resolution deferred); comma-separated use A.ump, B.ump;
requireStatement ** βœ… require [mixset], require subfeature [...] with boolean operators
isFeature * βœ… Feature declarations in mixsets and top-level
requirement ** βœ… Parsed, indexed, go-to-def
reqImplementation ** βœ… Identifiers reference requirements; go-to-def
Entity
mixsetDefinition ** βœ… Top-level and inside class/SM bodies
classDefinition ** βœ… Including nested classes
Class content
displayColor ** βœ… In class body and state body
abstract ** βœ… abstract; standalone
immutable ** βœ… immutable; standalone
keyDefinition ** βœ… key { attr1, attr2 } with attribute references
softwarePattern (isA, singleton, codeInjection) ** βœ…
depend ** βœ…
symmetricReflexiveAssociation ** βœ…
attribute ** βœ… All modifiers (incl. immutable), typed/untyped, defaults
inlineAssociation ** βœ… All arrow types; type refs include traits and interfaces
concreteMethodDeclaration ** βœ… Visibility, static, return type, params
constantDeclaration ** βœ…
enumerationDefinition ** βœ… Inside class or top-level
templateAttributeDefinition * βœ… name <<! ... !>>
emitMethod * βœ… emit name(params)(templates);
invariant * βœ… Both [expr] and named [name: expr]; name field is structurally distinct
State machine
inlineStateMachine ** βœ… With queued/pooled
state ** βœ… Nested states, concurrent regions (||)
transitions (event/guard/action) ** βœ… All forms: event, guard, pre-arrow action, post-arrow action; guard-before-event ordering; timed events after(N)/afterEvery(N)
guard semantics ** βœ… Structured constraint expressions; go-to-def and completion on attributes/constants inside guards (own + inherited); event params and method calls deferred
entry / exit / do ** βœ… Optional guard and language-tagged code blocks
referencedStateMachine ** βœ… sm as baseSM { ... } reuse; shared-state equivalence for refs/rename; diagram click navigation with alias-local-first / base-fallback
changeType markers (+/-/*) ** βœ…
standaloneTransition ** βœ… In SM body and state body
final states ** βœ… Final auto-terminal; final stateName {} explicit final
trace statements * βœ… Common forms: trace, tracecase, activate/deactivate; postfix clauses; full MOTL coverage not yet verified
concreteMethodDeclaration (in state body) * βœ… Methods inside state bodies
mixsetDefinition (in SM/state) ** βœ… In SM body, state body, and top-level
activeDefinition * βœ… active [codeLangs] [name] moreCode+; comma-separated lang tags are spec-valid but crash current compiler (E9100 bug)
Top-level entities
traitDefinition * βœ… Parameters (isA constraints, default types, &-multi-constraint), abstract methods, nested traits, application-side bindings
interfaceDefinition ** βœ…
associationDefinition ** βœ…
associationClassDefinition ** βœ…
stateMachineDefinition ** βœ…
topLevelCodeInjection * βœ… before/after/around { Class } op { code }
codeInjection (wildcard) * βœ… before/after with wildcard event patterns: e*, ev*eee, etc.
templateDefinition (top-level) * βœ… Excluded for project scope: official grammar defines it, but non-empty top-level templates crash the current compiler and no manual examples exist

Summary: βœ… 45 supported, ❌ 0 not supported, ⚠️ 1 partial

Editor Plugins

Editor Repo Auto-installs server?
VS Code umple.vscode (Marketplace) Bundled in .vsix at packaging time (not auto-pulled at runtime)
Zed umple.zed (Zed Extensions) Yes β€” downloaded from npm at extension load
Neovim umple.nvim Yes β€” npm install umple-lsp-server during plugin build
IntelliJ / JetBrains Setup guide (LSP4IJ + npm) No (npm install -g)
BBEdit Setup guide (plist + npm) No (npm install -g)
Sublime Text Setup guide (config only) No (manual build)

The LSP server is also available as an npm package: umple-lsp-server

Prerequisites

  • Node.js 20+ (tested on 20 and 23)
  • Java 11+ (for the Umple compiler β€” only needed if you want diagnostics)

Quick Start

npm install
npm run compile
npm run download-jar

Then install the plugin for your editor (see table above).

Architecture

umple-lsp/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ server/                        # Standalone LSP server (npm: umple-lsp-server)
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ server.ts              # LSP wiring, handlers, diagnostics orchestration
β”‚   β”‚   β”‚   β”œβ”€β”€ symbolIndex.ts         # Symbol indexing, storage, queries
β”‚   β”‚   β”‚   β”œβ”€β”€ resolver.ts            # Go-to-def / hover / rename symbol resolution
β”‚   β”‚   β”‚   β”œβ”€β”€ completionAnalysis.ts  # Completion context detection (scope, keywords)
β”‚   β”‚   β”‚   β”œβ”€β”€ completionBuilder.ts   # Completion item assembly
β”‚   β”‚   β”‚   β”œβ”€β”€ tokenAnalysis.ts       # Token/context detection at cursor position
β”‚   β”‚   β”‚   β”œβ”€β”€ referenceSearch.ts     # Find-references semantic matching
β”‚   β”‚   β”‚   β”œβ”€β”€ hoverBuilder.ts        # Hover markdown content builders
β”‚   β”‚   β”‚   β”œβ”€β”€ documentSymbolBuilder.ts # Document outline (symbol hierarchy)
β”‚   β”‚   β”‚   β”œβ”€β”€ formatter.ts           # Document formatting (indent, spacing, expansion)
β”‚   β”‚   β”‚   β”œβ”€β”€ formatRules.ts         # Formatting node classification
β”‚   β”‚   β”‚   β”œβ”€β”€ formatSafetyNet.ts     # Pre/post symbol-set check; aborts unsafe formats
β”‚   β”‚   β”‚   β”œβ”€β”€ diagramNavigation.ts   # Diagram click-to-select resolution
β”‚   β”‚   β”‚   β”œβ”€β”€ diagramRequests.ts     # Custom LSP request handlers for diagrams
β”‚   β”‚   β”‚   β”œβ”€β”€ importGraph.ts         # Forward/reverse import edge management
β”‚   β”‚   β”‚   β”œβ”€β”€ traitSmEventResolver.ts # Trait-side SM operation event lookup
β”‚   β”‚   β”‚   β”œβ”€β”€ renameValidation.ts    # RENAMEABLE_KINDS + kind-aware new-name regex
β”‚   β”‚   β”‚   β”œβ”€β”€ tokenTypes.ts          # Shared token/symbol type definitions
β”‚   β”‚   β”‚   β”œβ”€β”€ symbolTypes.ts         # Shared symbol entry types
β”‚   β”‚   β”‚   β”œβ”€β”€ treeUtils.ts           # Shared tree-walking utilities
β”‚   β”‚   β”‚   └── keywords.ts            # Built-in type names
β”‚   β”‚   β”œβ”€β”€ bin/umple-lsp-server       # 2-line shell shebang requiring out/server.js
β”‚   β”‚   └── test/                      # Semantic regression tests
β”‚   β”‚       β”œβ”€β”€ semantic.test.ts       # Test runner (682 assertions)
β”‚   β”‚       β”œβ”€β”€ helpers.ts             # Test harness helpers
β”‚   β”‚       └── fixtures/semantic/     # .ump fixture files
β”‚   └── tree-sitter-umple/             # Tree-sitter grammar & queries
β”œβ”€β”€ editors/                           # Setup guides for Sublime, manual Neovim config
└── test/                              # Sample .ump files
Editor Plugin (separate repos)
  β”‚
  └── (stdio) ──► server.ts ──► umplesync.jar (diagnostics)
                     β”‚
                     β”œβ”€β”€ resolver.ts ──► symbolIndex.ts (go-to-def, hover, rename)
                     β”œβ”€β”€ completionAnalysis.ts + completionBuilder.ts (completion)
                     β”œβ”€β”€ referenceSearch.ts (find-references)
                     β”œβ”€β”€ hoverBuilder.ts (hover content)
                     β”œβ”€β”€ documentSymbolBuilder.ts (outline)
                     β”œβ”€β”€ formatter.ts (formatting)
                     β”œβ”€β”€ diagramNavigation.ts + diagramRequests.ts (diagram clicks)
                     └── tokenAnalysis.ts + treeUtils.ts (shared analysis)
  • Server (packages/server/) β€” Editor-agnostic LSP server (npm-publishable as umple-lsp-server). Split into focused modules: server.ts handles LSP wiring and diagnostics orchestration; semantic logic lives in dedicated modules.
  • Tree-sitter grammar (packages/tree-sitter-umple/) β€” Parser and syntax highlighting queries

The server uses lazy indexing: files are only parsed when opened, and only files reachable via use statements are indexed. This keeps startup fast regardless of workspace size.

Tree-sitter Grammar

The tree-sitter grammar in packages/tree-sitter-umple/ is used by both the LSP server (for symbol indexing) and editors like Neovim (for syntax highlighting).

After editing grammar.js:

npm run build-grammar          # Regenerate parser + WASM + compile server

Configuration

The LSP server accepts these initialization options:

Option Type Default Description
umpleSyncJarPath string auto-discovered at <server>/../umplesync.jar since v0.2.6 Path to umplesync.jar. Diagnostics are silently disabled if the jar can't be found.
umpleSyncTimeoutMs number 30000 Timeout for umplesync per-request process (ms)

Environment variables: UMPLESYNC_JAR_PATH, UMPLESYNC_TIMEOUT_MS, UMPLE_TREE_SITTER_WASM_PATH

Development

In-depth docs: wiki/03-development.md covers first-time setup, dev symlink mode, programmatic test probes, and editor-specific reload tips. The summary below is just the most-used commands.

npm run compile        # Build server (also copies WASM)
npm run build-grammar  # Full rebuild after grammar.js changes
npm run watch          # Watch mode
npm test               # Run semantic regression tests (682 assertions)

Testing

The project includes a semantic regression test harness that exercises go-to-definition, find-references, completion, hover, document symbols, and formatting. Tests use real .ump fixture files with /*@marker*/ annotations for position-independent assertions.

npm test    # Compile + run all 682 assertions

Manual Testing

Run the server directly for JSON-RPC testing:

node packages/server/out/server.js --stdio

For Contributors

See wiki/ for the full project handoff:

Topic Page
What this project is + architecture 01-overview, 02-architecture
Setup, build, test 03-development
Editing the grammar 04-grammar
Releasing β€” npm 05-publishing-npm
Releasing β€” VS Code 06-publishing-vscode
Releasing β€” Zed 07-publishing-zed
Releasing β€” Neovim 08-publishing-nvim
BBEdit / IntelliJ / Sublime 09-other-editors
CI automation 10-ci-automation
Review process (collab w/ Codex) 11-collab-protocol
Common pitfalls 12-gotchas
Roadmap + known gaps 13-roadmap

About

Language Server Protocol (LSP) for Umple.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages