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.
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
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)
-
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
- Core
- Example usage (Backlog)
- stdlib/C4
- Example usage (Backlog)
- Other stdlib (Backlog)
- User Defined (Backlog)
- Core (Might be impossible with plantuml project structure)
- stdlib/C4 (Todo)
- Other stdlib (Backlog)
- User Defined (Backlog)
- Diagnostics currently depend on
plantuml -syntax
output - Core
- stdlib/C4
- Other stdlib
- User Defined
Other language server features are not currently planned. See the language server protocol specification for more info about other features.
- https://github.com/plantuml/plantuml.js/blob/main/plantuml-docs/docs_from_alphadoc/developers.adoc
plantuml -language
is a very helpful command (outputs language keywords)cat text.puml | plantuml -syntax
is also useful (checks if thing is valid plantuml, could be good for static analysis)- might be too slow for static analysis