Rez LSP Server
中文文档 | English
⚠️ Development Status: This project is in active development and is considered alpha software. APIs, configuration formats, and functionality may change without notice. Use in production environments is not recommended at this time.
A Language Server Protocol (LSP) implementation for Rez package manager, providing intelligent code completion, dependency resolution, and syntax validation for package.py files across all major IDEs.
✨ Features
🎯 Core LSP Features
- 🔍 Smart Package Completion: Intelligent package name and version completion
- 🔗 Dependency Resolution: Real-time dependency resolution and conflict detection
- 📝 Syntax Validation: Advanced Python and Rez-specific validation
- 🎯 Go to Definition: Navigate to package definitions with Ctrl+Click
- 🔍 Find References: Find all references to packages across your workspace
- 📋 Document Symbols: Outline view of package.py structure
- 🌍 Workspace Symbols: Search for packages across your entire workspace
- 💡 Hover Information: Rich tooltips with package details
🔧 Advanced Features
- ⚡ Performance Monitoring: Built-in metrics collection and profiling
- 🗄️ Multi-level Caching: Intelligent caching with TTL support
- 🔄 Incremental Updates: Efficient handling of file changes
- 🛡️ Smart Suggestions: Automatic fix suggestions for common issues
- 🌐 Cross-IDE Support: Works with VSCode, PyCharm, Vim, Neovim, and more
- 🛠️ High Performance: Built with Rust for speed and reliability
🎮 LSP Server Commands (VSCode)
- 🔄 Restart Server: Restart the LSP server without reloading VSCode
- 🛑 Stop Server: Stop the LSP server
- 🔄 Reload Workspace: Reload workspace configuration and package cache
- 📋 Open Logs: View detailed LSP server logs and diagnostics
- 🔨 Rebuild Dependencies: Rebuild build dependencies and refresh cache
- ⚙️ Toggle Check on Save: Enable/disable diagnostics when saving files
- 📊 Server Status: Interactive status bar with quick access to all commands
🚀 Quick Start
Prerequisites
- Rust 1.75+
- Rez package manager installed and configured
Installation
Option 1: One-Click Development Setup (Recommended)
For a complete development environment setup:
# Clone the repository
# Windows
# Linux/macOS
This will:
- Build the LSP server
- Build and install the VSCode extension
- Configure VSCode settings for development
- Set up the test environment
- Run basic tests
Option 2: Manual Installation
# Build the project
# The binary will be available at target/release/rez-lsp-server
Build System
We provide a unified build system that can build both the LSP server and VSCode extension:
# Windows
# Linux/macOS
# Using Make (cross-platform)
IDE Setup
VSCode
Option 1: Install from Marketplace (Coming Soon)
- Install the Rez LSP extension from the VSCode marketplace
- The extension will automatically detect and use the LSP server
Option 2: Development/Testing Setup
For testing the latest development version:
-
Build the LSP Server:
# The binary will be at target/release/rez-lsp-server -
Install VSCode Extension Dependencies:
-
Configure VSCode Settings: Add to your VSCode
settings.json: -
Test the Extension:
- Open the
vscode-extensionfolder in VSCode - Press
F5to launch a new Extension Development Host window - Open a Rez project with
package.pyfiles - Test code completion by typing in a
requireslist
- Open the
-
Environment Setup: Set the
REZ_PACKAGES_PATHenvironment variable:# Windows # Linux/macOS -
Verify Installation:
- Open a
package.pyfile - Check the "Rez LSP" output channel for server logs
- Try code completion in the
requiresfield
- Open a
Neovim
-- Add to your Neovim configuration
require..
🏗️ Architecture
The LSP server is built with a modular architecture:
- LSP Protocol Layer: Handles communication with IDEs
- Rez Parser: Parses package.py files and Rez syntax
- Package Discovery: Scans local package repositories
- Dependency Resolver: Resolves package dependencies and conflicts
- Completion Engine: Provides intelligent code completion
🛠️ Development
Building
Testing
Running
The server communicates via stdin/stdout using the LSP protocol.
🔧 Troubleshooting
VSCode Extension Issues
-
Server Not Starting:
- Check the "Rez LSP" output channel for error messages
- Verify the
rezLsp.serverPathsetting points to the correct executable - Ensure the LSP server binary has execute permissions
- Use
Rez LSP: Restart Servercommand to restart the server - Check the status bar for server status indicators
-
No Code Completion:
- Verify
REZ_PACKAGES_PATHenvironment variable is set - Check that package.py files exist in the configured paths
- Enable verbose logging with
"rezLsp.trace.server": "verbose"
- Verify
-
Performance Issues:
- Large package repositories may take time to scan initially
- Check the output channel for scan completion messages
- Consider reducing the number of package paths
Common Configuration Issues
-
Environment Variables:
# Verify Rez environment -
Package Discovery:
- Ensure package directories follow Rez structure:
package_name/version/package.py - Check file permissions on package directories
- Verify package.py files contain valid Python syntax
- Ensure package directories follow Rez structure:
-
LSP Server Logs:
- Enable debug logging:
export REZ_LSP_DEBUG=true - Check server output for detailed error messages
- Use
Rez LSP: Open Logscommand to view logs - Click the status bar item for quick access to server commands
- Enable debug logging:
📝 Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Setup
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run
cargo fmtandcargo clippy - Submit a pull request
📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
🙏 Acknowledgments
- Rez - The amazing package manager this LSP server supports
- tower-lsp - The LSP framework used in this project
- Academy Software Foundation - For maintaining Rez