summer-lsp
A Language Server Protocol (LSP) implementation for the summer-rs framework, providing intelligent IDE support for Rust applications built with summer-rs.
Features
๐ฏ TOML Configuration Support
- Smart completion for configuration sections and properties
- Real-time validation with detailed error messages
- Hover documentation with type information and examples
- Environment variable support (
${VAR:default}syntax) - Schema-based validation with automatic schema loading
๐ง Rust Macro Analysis
- Macro recognition for summer-rs macros (
#[derive(Service)],#[inject], route macros, job macros) - Macro expansion with readable generated code
- Parameter validation and error reporting
- Hover tooltips with macro documentation and usage examples
- Smart completion for macro parameters
๐ Route Management
- Route detection for all HTTP method macros (
#[get],#[post], etc.) - Path parameter parsing and validation
- Conflict detection for duplicate routes
- Route navigation and search capabilities
- RESTful style validation
๐ Advanced Features
- Dependency injection validation with circular dependency detection
- Component registration verification
- Performance monitoring and server status queries
- Configurable diagnostics with custom filtering
- Error recovery with graceful degradation
- Multi-document workspace support
Installation
Prerequisites
- Rust 1.70+
- A compatible editor with LSP support (VS Code, Neovim, Emacs, etc.)
From Source
The binary will be available at target/release/summer-lsp.
From crates.io
Pre-built Binaries
Download pre-built binaries from the releases page:
- Linux x86_64 (glibc and musl)
- macOS x86_64 and ARM64
- Windows x86_64
Editor Setup
VS Code
Option 1: Install the Extension (Recommended)
Install the official Summer RS LSP extension:
- From VSCode Marketplace (coming soon)
- Or install from VSIX:
The extension will automatically detect and start the language server.
Option 2: Manual Configuration
If you prefer manual setup, add to your settings.json:
See vscode/README.md for more details.
Neovim (with nvim-lspconfig)
require..
Emacs (with lsp-mode)
(add-to-list 'lsp-language-id-configuration '(toml-mode . "toml"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "/path/to/summer-lsp")
:major-modes '(toml-mode rust-mode)
:server-id 'summer-lsp))
Configuration
Create a .summer-lsp.toml file in your project root:
[]
= ["[", ".", "$", "{", "#", "("]
[]
= "https://summer-rs.github.io/config-schema.json"
[]
= ["deprecated-config"]
[]
= "info"
= false
Usage
Local Configuration Schema Generation
For projects using summer-rs, you can generate a local configuration schema for enhanced LSP support:
Quick Start
- Define your configuration:
use Configurable;
use submit_config_schema;
use Deserialize;
// Register the schema
submit_config_schema!;
- Add build script:
// build.rs
use write_merged_schema_to_file;
use env;
- Build your project:
The generated schema will be automatically discovered by summer-lsp, providing:
- โ Smart completion for your custom configurations
- โ Type validation and error checking
- โ Hover documentation from your doc comments
- โ Support for all serde attributes
Multi-Crate Workspace Support
In a Cargo workspace with multiple crates, summer-lsp automatically:
- ๐ Discovers all schema files from different crates
- ๐ Merges them into a single unified schema
- โจ Provides completion for all crate configurations
Example workspace structure:
my-workspace/
โโโ service-a/ # Generates schema for service-a configs
โโโ service-b/ # Generates schema for service-b configs
โโโ config/
โโโ app.toml # Can use configs from both crates
For detailed instructions, see SCHEMA_GENERATION_GUIDE.md.
TOML Configuration Files
summer-lsp automatically provides intelligent support for config/app.toml and related configuration files:
# Smart completion for configuration sections
[]
= "0.0.0.0" # Hover for documentation
= 8080 # Type validation
# Environment variable support
[]
= "${DATABASE_URL:postgresql://localhost/mydb}"
# Validation and error reporting
[]
= "redis://localhost:6379"
= 10 # Range validation
Rust Code Analysis
summer-lsp analyzes your Rust code for summer-rs specific patterns:
// Service macro with dependency injection
// Route macros with validation
async
// Job scheduling macros
async
Performance
summer-lsp is designed for high performance:
- Startup time: < 2 seconds
- Completion response: < 100ms
- Diagnostic updates: < 200ms
- Memory usage: < 50MB for typical projects
- Concurrent documents: 100+ supported
Supported Features
| Feature | TOML | Rust | Status |
|---|---|---|---|
| Syntax highlighting | โ | โ | Complete |
| Completion | โ | โ | Complete |
| Hover documentation | โ | โ | Complete |
| Diagnostics | โ | โ | Complete |
| Go to definition | โ ๏ธ | โ ๏ธ | Partial |
| Document symbols | โ ๏ธ | โ ๏ธ | Planned |
| Workspace symbols | โ ๏ธ | โ ๏ธ | Planned |
| Code actions | โ | โ | Planned |
| Formatting | โ | โ | Planned |
Architecture
summer-lsp follows a modular architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ LSP Protocol Layer โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Server Core Layer โ
โ (Message Dispatch, State Management) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ Config โ Macro โ Routing โ Diagnostic โ
โ Analysis โ Analysis โ Analysis โ Engine โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Foundation Layer โ
โ (Schema, Document, Index, Completion) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Development Setup
# ่ฟ่กๆต่ฏ
# ๅฏๅจๆๅกๅจ
Running Tests
# Unit tests
# Integration tests
# Property-based tests
# Performance tests
Documentation
- VSCode Extension Guide - VSCode extension usage
- API Documentation - Rust API docs
- Contributing Guide - Development guidelines
Changelog
See CHANGELOG.md for release history.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.
Acknowledgments
- summer-rs - The amazing Rust application framework
- taplo - TOML parsing and analysis
- lsp-server - LSP protocol implementation
- rust-analyzer - Inspiration for LSP architecture
summer-lsp - Intelligent IDE support for summer-rs applications