ruby-lsp 0.0.1

Ruby Language Server Protocol implementation for Rusty Ruby
Documentation

Ruby LSP

A Language Server Protocol (LSP) implementation for Ruby using the Oak LSP framework.

Overview

This project provides a dedicated LSP server for Ruby, separating the LSP functionality from the Oak Ruby parser framework. The goal is to keep Oak Ruby focused on its core responsibility as a parser framework, while providing a full-featured LSP server for Ruby development.

Features

  • Code Completion: Provides completion suggestions for Ruby keywords and identifiers
  • Hover Information: Displays context-aware information about Ruby symbols
  • Go to Definition: Navigates to the definition of symbols
  • Find References: Finds all references to a symbol
  • Code Diagnostics: Provides basic code analysis and error reporting
  • Syntax Highlighting: Provides syntax highlighting support
  • Code Formatting: Provides basic code formatting functionality

Installation

Prerequisites

  • Rust 1.60 or higher
  • Cargo package manager

Build

cd rusty-ruby/compilers/ruby-lsp
cargo build --release

Usage

Command Line

# Start the LSP server
ruby-lsp

Editor Integration

VS Code

  1. Install the Ruby LSP extension
  2. Configure the extension to use the custom LSP server:
{
  "rubyLsp.serverPath": "/path/to/rusty-ruby/target/release/ruby-lsp"
}

Vim/Neovim

Use a plugin like coc.nvim or LanguageClient-neovim and configure it to use the Ruby LSP server.

Architecture

The Ruby LSP server is built using the following components:

  • Oak LSP: Provides the core LSP server framework
  • Oak Ruby: Provides the Ruby parsing functionality
  • Oak VFS: Provides virtual file system abstraction

Project Structure

ruby-lsp/
├── bin/           # Binary entry point
│   └── main.rs    # Main server entry point
├── src/           # Source code
│   ├── lsp/       # LSP-specific functionality
│   │   ├── formatter/    # Code formatting
│   │   ├── highlighter/  # Syntax highlighting
│   │   └── mod.rs        # LSP module definition
│   └── lib.rs     # Main library implementation
├── Cargo.toml     # Cargo configuration
└── README.md      # This file

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.