Skip to content

ouywm/intellij-spring-rs

Repository files navigation

summer-rs Logo

summer-rs Plugin for RustRover

IDE support for the summer-rs framework — an application framework written in Rust, inspired by Java's SpringBoot. Legacy spring-rs projects are also supported.
English中文
JetBrains Plugin License

Features

  • New Project Wizard - Create summer-rs projects with plugin selection, example code generation, and crates.io dependency search
  • TOML Configuration Support - Smart completion, validation, navigation, and documentation for app.toml config files
  • Environment Variable Support - Auto-completion, validation, documentation, and navigation for ${VAR} references in TOML
  • Search Everywhere - Global search for HTTP routes, scheduled jobs, stream listeners, and components
  • Unified Tool Window - Browse all summer-rs items: Endpoints, Jobs, Stream Listeners, Components, Configurations, Plugins
  • Gutter Line Markers - Visual icons for routes, jobs, stream listeners, cache, sa-token, Socket.IO, middlewares
  • Route Conflict Detection - Cross-file duplicate route detection with click-to-navigate QuickFix
  • #[auto_config] Completion - Auto-complete configurator types (WebConfigurator, JobConfigurator)
  • Dependency Injection Validation - Validates #[inject(component)] types with framework component whitelists, #[component], and manual app.add_component(...) registrations
  • Run Configuration - Dedicated summer-rs run configuration with custom icons
  • JSON to Rust Struct - Convert JSON to Rust struct definitions with serde attributes
  • Custom Icons - summer-rs themed icons for config files

Requirements

  • RustRover 2025.1+ or IntelliJ IDEA 2023.3+ with the Rust plugin installed
  • A Rust project using summer-rs dependencies (spring-rs projects are also supported)

Installation

  1. Open your IDE and go to Settings/Preferences > Plugins
  2. Click Marketplace and search for "Summer Rs"
  3. Click Install and restart your IDE

Or install manually:

  1. Download the plugin ZIP from Releases
  2. Go to Settings/Preferences > Plugins > Gear icon > Install Plugin from Disk...
  3. Select the downloaded ZIP file

Search Everywhere

Double-press Shift to open Search Everywhere, then search for summer-rs items across your entire project.

Search Everywhere

Supported item types:

  • HTTP Routes — Search by path (e.g., /api/users) or handler name
  • Scheduled Jobs — Search by function name; displays cron/delay/rate expression
  • Stream Listeners — Search by topic name
  • Components — Search for #[derive(Service)], #[component], Configuration, and Plugin definitions

Each result shows an icon, name, details, and type badge. Click to navigate directly to the source code.


TOML Configuration Support

The plugin provides comprehensive IDE support for summer-rs configuration files (app.toml, app-dev.toml, app-prod.toml, etc.).

Smart Completion

Auto-complete section names, keys, and values based on Rust struct definitions annotated with #[derive(Configurable)] #[config_prefix = "xxx"].

TOML Section Completion

TOML Key Completion

TOML Value Completion

Enum Value Completion

Enum fields show all available variants from the Rust enum definition.

Enum Value Completion

Navigation

Ctrl+Click (or Cmd+Click on macOS) on any TOML key or section to jump directly to the corresponding Rust struct field.

TOML to Rust Navigation

Validation

Real-time inspections for:

  • Unknown sections
  • Unknown keys
  • Type mismatches (e.g., string where integer expected)
  • Invalid enum values

TOML Validation

Quick-fixes are available for common issues:

  • Add/remove quotes
  • Wrap value in array
  • Convert to inline table

TOML Quick Fix

Documentation

Hover over any TOML key or section (Ctrl+Q / F1) to see:

  • Field type
  • Default value
  • Doc comments from Rust source
  • Possible enum values

TOML Documentation


Environment Variable Support

Full IDE support for ${VAR} and ${VAR:default} environment variable references in TOML configuration files.

Environment Variable Completion

Auto-Completion

Type ${ in a TOML value to get suggestions from multiple sources (in priority order):

  1. .env files — Variables defined in .env at crate root and workspace root
  2. Already-used variables — Variables referenced in other TOML config files
  3. summer-rs known variablesSUMMER_ENV, SPRING_ENV, DATABASE_URL, REDIS_URL, HOST, PORT, LOG_LEVEL, RUST_LOG, MAIL_*, STREAM_URI, OTEL_*, etc.
  4. System environment — All system environment variables

Validation

Environment Variable Validation

  • Warning for undefined variables (not in .env or system env)
  • No warning if a default value is provided (${VAR:fallback})
  • Error for malformed references (empty name, invalid characters)

Documentation

Environment Variable Documentation

Hover over ${VAR} (Ctrl+Q) to see:

  • Variable name
  • Current value (from system env or .env file)
  • Default value (if specified)
  • Source (.env file path or "system environment")

Navigation

Ctrl+Click on ${VAR_NAME} to jump to the variable definition in your .env file.

Environment Variable Navigation


Unified Tool Window

The summer-rs tool window (right sidebar) provides a unified view of all summer-rs items in your project.

Unified Tool Window

Item Types

Switch between different item types using the Type dropdown:

Type Description
Endpoint HTTP routes (#[get], #[post], Router::new().route())
Job Scheduled tasks (#[cron], #[fix_delay], #[fix_rate])
Stream Listener Message stream handlers (#[stream_listener("topic")])
Component Services and declarative components (#[derive(Service)], #[component]) with injection points
Configuration Config structs with key-value tree (Rust defaults + TOML overrides)
Plugin Registered plugins (App::new().add_plugin(XxxPlugin))

Features

  • Tree View — Items organized by crate > module > file
  • Module Filter — Show items from specific crates only
  • Search — Filter items by name, path, or expression
  • Double-click — Navigate directly to the source code
  • Right-click Menu — Copy path, jump to configuration, etc.

Gutter Line Markers

Rich gutter icons on Rust functions and structs, providing at-a-glance information about summer-rs annotations.

Route Markers

Route Line Markers

Color-coded HTTP method badges on handler functions. Supports both attribute macros (#[get("/path")]) and Router builder (Router::new().route()).

Router Builder Support

Job Markers

Job Line Markers

Clock icon on scheduled task functions. Hover to see the schedule expression:

  • #[cron("1/10 * * * * *")] — Cron expression
  • #[fix_delay(10000)] — Fixed delay in milliseconds
  • #[fix_rate(5000)] — Fixed rate in milliseconds
  • #[one_shot(3000)] — One-time execution after delay

Stream Listener Markers

Stream Listener Markers

Listener icon on #[stream_listener] functions. Hover to see topics, consumer mode, and group ID.

Cache Markers

Cache Markers

Cache icon on #[cache("key_pattern")] functions. Hover to see key pattern, expire time, and condition.

sa-token Security Markers

sa-token Markers

Security icon on authentication/authorization annotations:

  • #[sa_check_login] — Login check
  • #[sa_check_role("admin")] — Role check
  • #[sa_check_permission("user:delete")] — Permission check
  • #[sa_check_roles_and(...)] / #[sa_check_roles_or(...)] — Multiple roles
  • #[sa_check_permissions_and(...)] / #[sa_check_permissions_or(...)] — Multiple permissions

Socket.IO Markers

Socket.IO Markers

Web icon on Socket.IO event handlers:

  • #[on_connection] — Connection handler
  • #[on_disconnect] — Disconnect handler
  • #[subscribe_message("event")] — Message subscription
  • #[on_fallback] — Fallback handler

Middleware Markers

Middleware Markers

Middleware icon on #[middlewares(mw1, mw2, ...)] module attributes. Hover to see the middleware list.

Service & Injection Markers

Service Markers

Gutter icons indicate summer-rs services, #[component] factories, and their injection points.

Inject Markers

Visual indicators for #[inject] fields showing dependency relationships. Click to navigate between services and injection sites.


Route Conflict Detection

The plugin detects duplicate route paths across all files within the same crate.

Route Conflict Detection

  • Conflicts are highlighted with WARNING-level annotations
  • Click the QuickFix to navigate directly to the conflicting handler function
  • Detection respects crate boundaries — routes in different crates do not conflict

#[auto_config] Completion

Auto-complete configurator types inside #[auto_config(...)] macros.

auto_config Completion

Supported configurators:

  • WebConfigurator — Register HTTP route handlers (from summer-web)
  • JobConfigurator — Register scheduled tasks (from summer-job)

Dependency Injection Validation

Real-time validation for #[inject(component)] fields.

DI Validation

  • Warns if the injected component type is not registered as a #[derive(Service)], #[component], or manual app.add_component(...) in the project
  • Built-in whitelist for framework-provided components: DbConn, Redis, Postgres, Mailer, Op, Producer, Operator

New Project Wizard

Create new summer-rs projects with a guided wizard.

Plugin Selection

Plugin Selection

Choose from 13 summer-rs plugins organized in a flat 2-column grid:

  • Websummer-web (HTTP server with Axum)
  • gRPCsummer-grpc (gRPC server with Tonic)
  • PostgreSQLsummer-postgres (native PostgreSQL)
  • SQLxsummer-sqlx (async SQL with SQLx)
  • Sea-ORMsummer-sea-orm (ORM with SeaORM)
  • Streamsummer-stream (message streams)
  • Mailsummer-mail (email via Lettre)
  • Redissummer-redis (Redis client)
  • OpenDALsummer-opendal (unified storage)
  • Jobsummer-job (cron scheduling with Tokio-cron)
  • Apalissummer-apalis (background job processing)
  • sa-tokensummer-sa-token (session/permission auth)
  • OpenTelemetrysummer-opentelemetry (tracing/metrics)

Extra Dependencies

Extra Dependencies

Search and add custom crate dependencies from crates.io:

  • Left panel shows search results with pagination (auto-load on scroll)
  • Right panel shows added dependencies
  • All dependencies are deduplicated with plugin-provided crates in the generated Cargo.toml

Example Code Generation

Optionally generate compilable example code for each selected plugin, based on official summer-rs examples.


Run Configuration

summer-rs Run Configuration

Dedicated run configuration type with summer-rs branding.

Run Configuration

Gutter Run Icon

Custom summer-rs icon on main() function for quick launch.

Main Run Icon

Right-click the gutter icon to:

  • Run the application
  • Debug the application
  • Edit run configuration

JSON to Rust Struct

Convert JSON to Rust struct definitions with proper serde attributes.

How to Use

  1. Right-click in editor > JSON to Rust Struct, or
  2. Generate menu (Alt+Insert / Cmd+N) > JSON to Rust Struct

JSON to Struct Menu

Conversion Dialog

Paste your JSON and configure options:

  • Struct name
  • Derive macros (Serialize, Deserialize, Debug, Clone)
  • Field visibility (pub)
  • serde rename attributes

JSON to Struct Dialog

Features

  • Nested objects become nested structs
  • Arrays become Vec<T>
  • Null values become Option<T>
  • camelCase automatically converts to snake_case with serde rename
  • Mixed types become serde_json::Value

Custom File Icons

Config File Icons

summer-rs configuration files (app.toml, app-*.toml) display a custom leaf icon.

Config File Icon


Configuration

The plugin automatically detects summer-rs projects and remains compatible with legacy spring-rs projects by checking framework dependencies in Cargo.toml:

[dependencies]
summer = "0.5.0"
summer-web = "0.5.0"
summer-sqlx = "0.5.0"

Legacy spring = "..." and spring-* dependencies are also recognized.

No additional configuration is required.


Building from Source

# Clone the repository
git clone https://github.com/ouywm/intellij-spring-rs.git
cd intellij-spring-rs

# Build the plugin
./gradlew buildPlugin

# Run IDE with the plugin (for testing)
./gradlew runIde

# Run tests
./gradlew test

Multi-Platform Build

Build for different IDE versions:

# RustRover 2025.1+ (default)
./gradlew -PplatformVersion=251 buildPlugin

# IntelliJ IDEA 2024.1
./gradlew -PplatformVersion=241 buildPlugin

# IntelliJ IDEA 2023.3
./gradlew -PplatformVersion=233 buildPlugin

The built plugin ZIP is located at build/distributions/.


Contributing

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

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Related Links


License

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


Sponsor

If this plugin is helpful to you, please consider supporting me:

WeChat Alipay
WeChat Alipay

About

IntelliJ plugin for spring-rs framework - TOML config completion, validation, navigation, route explorer, and more

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages