# 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
```bash
cd rusty-ruby/compilers/ruby-lsp
cargo build --release
```
## Usage
### Command Line
```bash
# Start the LSP server
ruby-lsp
```
### Editor Integration
#### VS Code
1. Install the [Ruby LSP](https://marketplace.visualstudio.com/items?itemName=Shopify.ruby-lsp) extension
2. Configure the extension to use the custom LSP server:
```json
{
"rubyLsp.serverPath": "/path/to/rusty-ruby/target/release/ruby-lsp"
}
```
#### Vim/Neovim
Use a plugin like [coc.nvim](https://github.com/neoclide/coc.nvim) or [LanguageClient-neovim](https://github.com/autozimu/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](LICENSE) file for details.