Skip to content

ptdewey/plantuml-lsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PlantUML LSP

An implementation of the language server protocol (LSP) for PlantUML.

Disclaimer: This project is early in development, so features may be missing. Contributions are welcome, please open an issue or PR if you would like to add something.

Installation

With Go Install

go install github.com/ptdewey/plantuml-lsp

From Source:

# clone repository
git clone https://github.com/ptdewey/plantuml-lsp.git
cd plantuml-lsp

# build lsp binary
go build
cd ..

Plantuml stdlib Setup

# (optional but recommended) clone stdlib repo
git clone https://github.com/plantuml/plantuml-stdlib.git
# or alternatively, extract stdlib from plantuml executable
plantuml -extractstdlib

Setup

Neovim (with lspconfig):

config = function()
    local lspconfig = require("lspconfig")
    local configs = require("lspconfig.configs")
    if not configs.plantuml_lsp then
        configs.plantuml_lsp = {
            default_config = {
                cmd = {
                    "/path/to/plantuml-lsp",
                    "--stdlib-path=/path/to/plantuml-stdlib",

                    --
                    -- FOR DIAGNOSTICS (choose up to one of 'jar-path' and 'exec-path' flags):
                    --
                    -- Running plantuml via a .jar file:
                    "--jar-path=/path/to/plantuml.jar",
                    -- With plantuml executable and available from your PATH there is a simpler method:
                    "--exec-path=plantuml",
                },
                filetypes = { "plantuml" },
                root_dir = function(fname)
                    return lspconfig.util.find_git_ancestor(fname) or lspconfig.util.path.dirname(fname)
                end,
                settings = {},
            }
        }
    end
    lspconfig.plantuml_lsp.setup {}
end,
  • NOTE: This assumes plantuml is set up as a filetype already
  • NOTE: cmd flags --exec-path and --jar-path are used to derive diagnostics. These flags can optionally be omitted
    • This argument allows for use of plantuml via a Jar or a system visible binary.
    • Only one of these flags should be specified at a given time.

VS Code:

TODO: VSCode extension (help wanted)


Capabilities

Completion:

  • Core (WIP)

    • Types, keywords, directives
    • Colors, skinparams (Figuring out if these should be included)
  • stdlib/C4 (WIP)

    • Procedures
    • Functions, globals, defines, constants, variables (Todo)
  • Other stdlib (Todo)

  • User Defined (Todo)

  • Snippets (WIP)

    • Core (Todo)
    • stdlib/C4

Hover

  • Core
    • Example usage (Backlog)
  • stdlib/C4
    • Example usage (Backlog)
  • Other stdlib (Backlog)
  • User Defined (Backlog)

Definition

  • Core (Might be impossible with plantuml project structure)
  • stdlib/C4 (Todo)
  • Other stdlib (Backlog)
  • User Defined (Backlog)

Diagnostics

  • Diagnostics currently depend on plantuml -syntax output
  • Core
  • stdlib/C4
  • Other stdlib
  • User Defined

Other Language Server Features

Other language server features are not currently planned. See the language server protocol specification for more info about other features.


Developer Notes

LSP Specification

PlantUML Language specification: