Skip to content

orien/pony-zed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pony Zed Extension

Pony language support for the Zed editor.

About Pony

Pony is an open-source, object-oriented, actor-model, capabilities-secure, high-performance programming language. It features:

  • Memory safety without garbage collection using reference capabilities
  • Data-race freedom guaranteed at compile time
  • Actor-based concurrency for high performance
  • Type safety with static typing
  • Pattern matching and modern functional programming features

Features

This extension provides Pony language support for Zed, including:

  • Syntax highlighting - Full syntax highlighting for Pony language constructs
  • Auto-indentation - Smart indentation based on code structure
  • Code navigation - Outline panel and breadcrumbs for quick navigation
  • Bracket matching - Syntax-aware bracket pairing and rainbow brackets
  • Vim text objects - Text objects for functions, classes, and comments (vim mode)
  • Corral tasks - Built-in tasks for fetching dependencies and building projects
  • Language Server Protocol (LSP) integration - Basic LSP support
  • Go to definition - Navigate to symbol definitions

Note: The Pony LSP server (v0.2.2) is still in early development. Additional features like hover documentation, code completion, find references, and rename are not yet implemented in the server itself.

Installation

From Zed Extensions

Once published, you'll be able to install this extension directly from the Zed extensions panel:

  1. Open Zed
  2. Press cmd-shift-x (macOS) or ctrl-shift-x (Linux/Windows)
  3. Search for "Pony"
  4. Click Install

Development Installation

To test this extension during development:

  1. Open Zed
  2. Navigate to the Extensions panel
  3. Click "Install Dev Extension"
  4. Select this repository directory

Language Server Installation (Required for LSP Features)

To enable LSP features, you must install pony-lsp:

# Clone and build pony-language-server
git clone https://github.com/ponylang/pony-language-server
cd pony-language-server
make language_server

# The binary will be at: build/release/pony-lsp
# Add it to your PATH, for example:
export PATH="$PATH:$(pwd)/build/release"

Verify installation:

which pony-lsp

Note: The language server must be built from source as there are no prebuilt binaries available.

Configuration

Pony Standard Library Path

The extension needs to know where to find the Pony standard library packages. Add this to your Zed settings.json:

  1. Open Zed settings: cmd-, (macOS) or ctrl-, (Linux/Windows)
  2. Add the following configuration:
{
  "lsp": {
    "pony-language-server": {
      "settings": {
        "pony_stdlib_path": "/opt/homebrew/Cellar/ponyc/0.60.4/packages"
      }
    }
  }
}

Finding your stdlib path:

On macOS/Linux, run this command to find the correct path:

readlink -f $(which ponyc) | sed 's|/bin/ponyc|/packages|'

Or manually locate it based on your Pony installation:

  • Homebrew (Apple Silicon): /opt/homebrew/Cellar/ponyc/VERSION/packages
  • Homebrew (Intel Mac): /usr/local/Cellar/ponyc/VERSION/packages
  • Linux: /usr/lib/pony or /usr/share/ponyc/packages

Replace VERSION with your installed Pony version (e.g., 0.60.4).

Usage

Corral Tasks

The extension provides built-in tasks for Corral (Pony's package manager):

  • corral fetch - Download dependencies defined in corral.json
  • corral run -- ponyc - Build your project using Corral's package paths

To run a task:

  1. Open the command palette: cmd-shift-P (macOS) or ctrl-shift-P (Linux/Windows)
  2. Type "task" and select "task: spawn"
  3. Choose a corral task from the list

Development

Prerequisites

Building

The extension includes Rust code for LSP integration and must be compiled:

cargo build --release

The tree-sitter-pony grammar is automatically fetched and compiled by Zed when you install the extension.

Project Structure

pony-zed-extension/
β”œβ”€β”€ Cargo.toml          # Rust project manifest
β”œβ”€β”€ extension.toml      # Extension metadata and LSP registration
β”œβ”€β”€ src/
β”‚   └── pony.rs         # LSP integration code
β”œβ”€β”€ languages/          # Language definitions
β”‚   └── pony/
β”‚       β”œβ”€β”€ config.toml      # Language configuration
β”‚       β”œβ”€β”€ highlights.scm   # Syntax highlighting rules
β”‚       β”œβ”€β”€ indents.scm      # Auto-indentation rules
β”‚       β”œβ”€β”€ outline.scm      # Code navigation and outline
β”‚       β”œβ”€β”€ brackets.scm     # Bracket matching rules
β”‚       β”œβ”€β”€ textobjects.scm  # Vim text object definitions
β”‚       └── tasks.json       # Corral build tasks
β”œβ”€β”€ LICENSE
└── README.md

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

Troubleshooting

"pony-lsp not found on PATH"

If you see this error when opening a .pony file:

  1. Verify installation: which pony-lsp
  2. Ensure the binary is in your PATH
  3. Restart Zed after modifying PATH
  4. Check Zed log for details: cmd-shift-P β†’ "zed: open log"

LSP compilation errors or "go to definition" not working

If the LSP server is running but features don't work:

  1. Ensure you've configured pony_stdlib_path in your Zed settings (see Configuration section above)
  2. Verify the stdlib path exists: ls /path/to/your/stdlib/builtin
  3. Check the LSP logs: cmd-shift-P β†’ "zed: open log"
  4. Look for "initial PONYPATH:" in the logs - it should include both your project and stdlib paths
  5. Ensure your project has a corral.json file listing local packages

LSP server not starting

  1. Verify pony-lsp is installed and on PATH
  2. Check Zed log for pony-lsp errors
  3. Ensure you're using pony-language-server v0.2.2 or later

Extension not loading

  1. Check that Rust code compiles: cargo build --release
  2. Reload extensions in Zed: cmd-shift-P β†’ "zed: reload extensions"
  3. Check Zed log for extension errors

Resources

License

This project is licensed under the 3-Clause BSD License. See the LICENSE file for details.

About

🐴 Pony language support for the Zed editor.

Topics

Resources

License

Stars

Watchers

Forks