A fast Language Server Protocol implementation for Ruby written in Rust.
- Syntax highlighting
- Code completion
- Hover information
- Go to definition
- Error checking
- AST visualization
The LSP is built with the following components:
- Server: Implements the LSP protocol and handles client communication
- Parser: Uses Ruby Prism to parse Ruby code
- Analyzer: Analyzes the parsed code to provide language features
- Indexer: Indexes Ruby symbols for fast lookup and navigation
- AST Visualizer: Provides a visual representation of the Ruby Abstract Syntax Tree
- Rust (latest stable version)
- Cargo
The test suite is organized by component:
- Server tests: src/tests/server_tests.rs
- Parser tests: src/tests/parser_tests.rs
- Indexer tests: src/tests/indexer_tests.rs
- Analyzer tests: src/tests/analyzer_tests.rs
- Integration tests: src/tests/integration_test.rs
To run tests for a specific component:
cargo test --test server_tests
See src/tests/README.md for more details on the test suite.
- Install the Ruby Fast LSP extension
- Open a Ruby file
- The LSP will automatically start and provide language features
- Install the Ruby Fast LSP
- Configure Neovim to use the LSP
- Open a Ruby file
- The LSP will automatically start and provide language features
The AST Visualizer helps you understand how Ruby code is parsed into an Abstract Syntax Tree.
- Run the visualizer script from the project root:
# Default port (8080)
./run_ast_visualizer.sh
# Or specify a custom port
./run_ast_visualizer.sh 3000
- This will start the server and open the visualizer in your browser
- Enter Ruby code in the left panel and the AST will update in real-time
- Explore the AST in the right panel by expanding/collapsing nodes
- You can toggle real-time parsing on/off with the checkbox
You can also start the server manually and access it in your browser:
# Start the server with default port (8080)
cargo run -p ast-visualizer
# Or specify a custom port
PORT=3000 cargo run -p ast-visualizer
# Then open in your browser (use the port shown in the server output)
open "http://localhost:8080"
The server will automatically find an available port if the specified port is already in use.
MIT