list of dots Digital Research Alliance of Canada logo  NSERC logo  University of Ottawa logo / Université d'Ottawa

User Manual    [Previous]   [Next]   

Neovim

umple.nvim

Neovim plugin for the Umple modeling language. Provides diagnostics, code completion, go-to-definition, find references, rename, hover, formatting, and syntax highlighting for .ump files.


Requirements

  • Neovim 0.9+ (0.10+ recommended)
  • Node.js 18+ (for running the LSP server)
  • A C compiler (cc or gcc) for compiling the tree-sitter parser
  • Java 11+ (optional — only needed for diagnostics)
  • A plugin manager — this guide uses lazy.nvim

Installing prerequisites

macOS (via Homebrew):

brew install neovim node
brew install openjdk  # optional, for diagnostics

Ubuntu/Debian:

sudo apt install neovim nodejs npm build-essential
sudo apt install default-jdk  # optional, for diagnostics

Setting up lazy.nvim

If you don’t have a plugin manager yet, follow the lazy.nvim installation guide.


Installation

Add this to your lazy.nvim plugin list:

{
  'umple/umple.nvim',
  build = './scripts/build.sh',
  dependencies = {
    'neovim/nvim-lspconfig',
    'nvim-treesitter/nvim-treesitter',
  },
  config = function()
    require("umple-lsp").setup()
  end,
}

The build script downloads the LSP server from npm and fetches the tree-sitter grammar. The tree-sitter parser is compiled automatically on first load — no manual steps needed.


Auto-completion (recommended)

For auto-popup completion, install a completion plugin such as nvim-cmp with cmp-nvim-lsp. Without one, the LSP server still provides completions but you won’t see them automatically.


Configuration

require("umple-lsp").setup({
  port = 5556,  -- UmpleSync port (default: 5556)
  on_attach = function(client, bufnr)
    -- your custom keybindings
  end,
})

Keybindings

No keybindings are set by default — use on_attach to configure your own. Example:

require("umple-lsp").setup({
  on_attach = function(client, bufnr)
    local opts = { buffer = bufnr }
    vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
    vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
    vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
    vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
    vim.keymap.set("n", "<leader>f", vim.lsp.buf.format, opts)
    vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, opts)
    vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
    vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
  end,
})

Features

  • Diagnostics: Real-time error and warning detection (requires Java)
  • Go-to-definition: Jump to classes, interfaces, traits, enums, attributes, methods, state machines, states, associations, mixsets, requirements, and use statements
  • Find references: Semantic reference search across all reachable files
  • Rename: Safe symbol rename across all references
  • Hover: Contextual information for symbols
  • Code completion: Context-aware keyword and symbol completion
  • Document symbols: Hierarchical outline (accessible via :Telescope lsp_document_symbols or similar)
  • Formatting: AST-driven indent correction, arrow spacing, blank-line normalization
  • Syntax highlighting: Via tree-sitter grammar (compiled automatically)
  • Cross-file support: Transitive use statement resolution and cross-file diagnostics

Updating

:Lazy update umple.nvim

This pulls the latest plugin code and re-runs the build script (which updates the LSP server and tree-sitter grammar).


Troubleshooting


No syntax highlighting

The plugin compiles the tree-sitter parser on first load. If it fails:

  1. Make sure you have a C compiler: cc --version or gcc --version
  2. Delete the cached parser and restart Neovim to recompile:

    rm -f ~/.local/share/nvim/site/parser/umple.so
    rm -rf ~/.local/share/nvim/site/queries/umple

No diagnostics

Diagnostics require Java 11+. Verify: java -version


LSP not starting

  1. Check that Node.js is installed: node --version
  2. Run :LspLog in Neovim to see server errors
  3. Rebuild the plugin: :Lazy build umple.nvim

Development

To test local changes to the LSP server:

  1. Clone both repos side by side:
workspace/
├── umple-lsp/       # LSP server monorepo
└── umple.nvim/      # This plugin
  1. Build the server locally:
cd umple-lsp
npm install
npm run compile
npm run download-jar
  1. Override the plugin’s paths to use your local build:
{
  dir = '/path/to/umple.nvim',
  dependencies = {
    'neovim/nvim-lspconfig',
    'nvim-treesitter/nvim-treesitter',
  },
  config = function()
    require("umple-lsp").setup({
      plugin_dir = '/path/to/umple.nvim',
    })
  end,
}

Then symlink the local server into the plugin’s expected locations:

cd umple.nvim
# Symlink tree-sitter grammar
ln -sf ../umple-lsp/packages/tree-sitter-umple tree-sitter-umple
# Symlink local server into node_modules (jar is already inside packages/server/)
mkdir -p node_modules
ln -sf ../../umple-lsp/packages/server node_modules/umple-lsp-server

After making changes to the server, recompile and restart:

cd umple-lsp
npm run compile       # Server-only changes
npm run build-grammar # After grammar.js changes (regenerates parser + WASM + compiles)

Then in Neovim: :LspRestart

After grammar changes, also delete the cached native parser so Neovim recompiles it:

rm -f ~/.local/share/nvim/site/parser/umple.so
rm -rf ~/.local/share/nvim/site/queries/umple

How it works

The build script installs the pre-compiled umple-lsp-server from npm, downloads umplesync.jar for diagnostics, and extracts the tree-sitter grammar (src/parser.c + queries/) from the umple-lsp repo. The plugin compiles the tree-sitter parser automatically on first load (into ~/.local/share/nvim/site/parser/umple.so) and points Neovim’s LSP client at the npm-installed server.


Original markdown source for this page: https://github.com/umple/umple.nvim/blob/master/README.md