tools/pony-lsp/README.md
pony-lsp implements the Language Server Protocol for Pony. It communicates with editors via stdout/stdin, and is built and distributed alongside ponyc via ponyup.
For user documentation — installation and editor configuration — see the pony-lsp documentation on the Ponylang website.
| Feature | Description |
|---|---|
| Diagnostics (push, pull, refresh and change notifications) | Ponyc errors and related information is reported as LSP diagnostics. |
| Hover | Additional information is shown for: entities, methods, fields, local variables and references. |
| Signature Help | Parameter hints are shown when the cursor is inside a call expression, with the active parameter highlighted. Includes the method's docstring when present. Requires the file to be saved — signature help is not available while the file has unsaved edits. |
| Go To Definition | For most language constructs, you can go from a reference to its definition. |
| Go To Declaration | Navigate from a reference to the declaration site of a symbol. |
| Go To Type Definition | Navigate to the type definition of the symbol under the cursor. |
| Document Symbols | pony-lsp provides a list of available symbols for each opened document. |
| Workspace Symbols | Fuzzy search over all symbols across the entire workspace. |
| Document Highlight | All occurrences of the symbol under the cursor are highlighted simultaneously across the document. |
| Inlay Hints | Three kinds of hints are shown inline. For let, var, and field declarations with no type annotation, the full inferred type appears after the variable name. For annotated types where the capability is omitted — in variable and field declarations, function parameter types, generic type arguments, and union and tuple members — the missing capability keyword appears after the type name. For fun declarations, the implicit receiver capability appears before the function name and the implicit return type appears after the closing parenthesis. |
| Find References | All references to the symbol under the cursor are returned, with optional inclusion of the declaration site. |
| Rename | Rename a symbol and all its references across the workspace. |
| Folding Range | Code folding ranges are provided for blocks, methods, classes, and other structured constructs. |
| Selection Range | Smart expand/shrink selection based on the AST structure of the document. |
New features are actively being added. Contributions are welcome — we are happy to provide help and guidance.
pony-lsp supports settings via the workspace/configuration request and workspace/didChangeConfiguration notification.
| Setting | Type | Example | Description |
|---|---|---|---|
defines | Array[String] | ["FOO", "BAR"] | Defines active during compilation, equivalent to the -D flag in ponyc |
ponypath | Array[String] | ["/path/to/pony/package"] | Additional package search paths |
Example settings in JSON:
{
"defines": ["FOO", "BAR"],
"ponypath": ["/path/to/pony/package", "/another/path"]
}
First, follow the ponyc build documentation and make sure you have everything to build ponyc. Then building pony-lsp is as easy as:
make pony-lsp
If pony-lsp is not working as expected, please open an issue. Include a minimal Pony program that reproduces the problem, the pony-lsp version, and the LSP client/editor you are using.