Skip to content

Releases: sorafujitani/rfmt

v1.6.3

24 Apr 05:05

Choose a tag to compare

What's Changed

Minor stability refinements on top of the 1.6.x architecture release. See the 1.6.1 notes below for the feature set this series delivers.

Installation

gem install rfmt -v 1.6.3

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

What's Changed

  • Fix: chain reformatting leaves multi-line arguments orphaned by @sorafujitani in #106

Full Changelog: v1.6.2...v1.6.3

v1.6.2

24 Apr 04:40

Choose a tag to compare

Note: a follow-up release v1.6.3 is available — we recommend installing the latest version (gem install rfmt picks it up automatically).


What's Changed

Minor stability refinements on top of the 1.6.x architecture release. See the 1.6.1 notes below for the feature set this series delivers.

Installation

gem install rfmt -v 1.6.2

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

What's Changed

  • Fix: orphan comments inside do…end blocks merging with end by @sorafujitani in #105

Full Changelog: v1.6.1...v1.6.2

v1.6.1

24 Apr 02:33

Choose a tag to compare

Note: a follow-up release v1.6.3 is available — we recommend installing the latest version (gem install rfmt picks it up automatically).


What's Changed

Follow-up release consolidating the 1.6.0 architecture work.

Rule-based formatter

The rule-based format/ pipeline (Formatter, Registry, Rule) is the canonical formatting path, replacing the legacy monolithic emitter. Rules covering body indentation (StatementsRule), singleton classes (SingletonClassRule), and variable writes (VariableWriteRule) ship as part of the default registry. The Intermediate Representation (IR) module decouples parsing from emission for composability and testability.

Method chain reformatting

Multi-line method chains can be reformatted from aligned style (indented under the first dot) to indented style (one level beyond the receiver), preserving the source's base indent. The pass is wired into the fallback path for resilience.

Printer optimizations

The printer carries a pre-computed indent cache and inline hints for the hot path; reformat_chain_lines has been deduplicated across rules and uses Cow<str> to avoid allocations on pass-through.

Editor integration

Setup guides for VSCode, Neovim, Helix, Emacs, and Zed land in the repository; every editor uses the Ruby LSP addon system, so there are no editor-specific plugins to maintain. The README's Editor Integration section replaces the previous "Coming Soon" placeholder with a VSCode quick start.

Installation

gem install rfmt -v 1.6.1

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

What's Changed

Full Changelog: v1.6.0...v1.6.1

v1.6.0

23 Apr 14:05

Choose a tag to compare

Note: a follow-up release v1.6.3 is available — we recommend installing the latest version (gem install rfmt picks it up automatically).


What's Changed

Added

  • Rule-based formatter architecture: new modular format/ pipeline (Formatter, Registry, Rule) replacing the legacy monolithic emitter
  • Intermediate Representation (IR) module: decouples parsing from emission for composability and testability
  • New formatter rules: StatementsRule (body indentation), SingletonClassRule, VariableWriteRule
  • Method chain reformatting: convert aligned style to indented style when lines exceed the configured width
  • Chain reformatting wired into the fallback path for resilience
  • config module exported for test consumption
  • Editor Integration Documentation: comprehensive setup guides for VSCode, Neovim, Helix, Emacs, and Zed
    • VSCode: Format on Save configuration with Ruby LSP, settings reference table, project-specific setup
    • Zed: full configuration with initialization_options and format_on_save
    • All editors work through the Ruby LSP addon system — no editor-specific plugins required
  • README: Editor Integration section updated with VSCode quick start (replacing "Coming Soon")

Changed

  • Printer optimized with indent cache and inline hints
  • reformat_chain_lines deduplicated across rules and optimized with Cow to reduce allocations
  • README: Neovim integration updated from CLI-based to Ruby LSP-based approach
  • Removed Sublime Text section from editor documentation (replaced by Zed)

Fixed

  • Prism comment JSON deserialization now accepts comment_type and embdoc fields (#97)
  • BTreeMap range panic when computing comment indices on edge inputs
  • Comment duplication during source extraction
  • Empty source input handled gracefully by the formatter runner
  • Clippy warnings: use repeat_n

Removed

  • Legacy Emitter module (1844 LOC) — superseded by the new Formatter

Installation

gem install rfmt -v 1.6.0

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

What's Changed

  • Rule-based Formatter Architecture with Performance Optimizations by @sorafujitani in #96
  • Fix Prism comment JSON deserialization (comment_type / embdoc) by @sorafujitani in #97

Full Changelog: v1.5.3...v1.6.0

v1.5.3

25 Feb 11:05

Choose a tag to compare

What's Changed (since v1.5.0)

Fixed

  • Fix inline modifier if/unless formatting (#87)
  • Fix heredoc command incorrectly removed (#90, #86)
  • Fix method chain command dependency handling (#89, #85)
  • Fix Nix bundler version conflict (remove pkgs.bundler, use Ruby built-in)

Added

  • IDE format on save support (VS Code, Neovim, etc.)
  • Instance variable write node emission support (#92)
  • Heredoc comment deletion support
  • Place block loop emission support

Changed

  • Nix dev environment optimization (build caching, direnv support, devShell splitting)
  • Code formatting improvements (clippy, rustfmt, RuboCop compliance)
  • Update package dependencies
  • Update README.md

Installation

gem install rfmt -v 1.5.3

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

What's Changed

  • Fix duplicate comment output when method chain has block by @sorafujitani in #89
  • Fix heredoc content and closing identifier being removed in method call arguments by @sorafujitani in #90
  • Add emit support for variable write nodes (InstanceVariableWriteNode, LocalVariableWriteNode) by @sorafujitani in #92

Full Changelog: v1.5.0...v1.5.3

v1.5.0

25 Jan 09:40

Choose a tag to compare

What's Changed

Added

  • Docker Compose test environment setup (#84)
  • Support for then expression emission (#80)
  • CI support for Ruby 3.4 and Ruby 4 (#82)

Changed

  • Upgrade Magnus (Rust-Ruby FFI library) (#83)
  • Optimize Docker build with multi-stage and caching (#84)
  • Upgrade unicode-emoji dependency

Fixed

  • Preserve heredoc content and closing identifier (#81)
  • Fix rescue/ensure clauses being deleted inside do...end blocks (#78)
  • Fix inline comment node handling (#77)
  • Fix BTreeMap range error (Issue #71)

Installation

gem install rfmt -v 1.5.0

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

What's Changed

  • Fix inline comment misplacement after brace blocks by @fs0414 in #77
  • Fix rescue/ensure clauses being deleted in do...end blocks by @fs0414 in #78
  • Fix BTreeMap range error with endless method + comment by @fs0414 in #76
  • Fix inline then style preservation for in/when/if expressions by @fs0414 in #80
  • Fix heredoc content and closing identifier being removed by @fs0414 in #81
  • feat(ci): Actions Ruby 4.0 support by @fs0414 in #82
  • Add Docker test environment for gem install verification by @fs0414 in #84
  • Add Ruby 4.0 support: upgrade magnus to 0.8.2 and update CI by @fs0414 in #83

Full Changelog: v1.4.1...v1.5.0

v1.4.1

17 Jan 08:48

Choose a tag to compare

What's Changed

Fixed

  • Fixed comment positioning issue where standalone comments before end statements were incorrectly attached to previous code lines
  • Improved comment semantic preservation to maintain developer's original placement intent
  • Enhanced standalone comment detection logic to distinguish between inline and independent comments

Installation

gem install rfmt -v 1.4.1

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

Full Changelog: v1.4.0...v1.4.1

v1.3.2

09 Jan 14:16

Choose a tag to compare

What's Changed

Added

  • Implement std::str::FromStr trait for NodeType
  • Unit tests for validation module

Changed

  • Use serde enum for comment type deserialization (type-safe JSON parsing)
  • Convert recursive find_last_code_line to iterative approach (prevent stack overflow)
  • Use BTreeMap index for comment lookup in emit_statements (O(n) → O(log n))

Fixed

  • Remove panic-prone unwrap() on Mutex lock in logger (prevent Ruby VM crash)

Installation

gem install rfmt -v 1.3.2

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

What's Changed

  • fix: remove panic-prone unwrap() on Mutex lock in logger by @fs0414 in #52
  • test: add unit tests for validation module by @fs0414 in #53
  • refactor: convert find_last_code_line to iterative approach by @fs0414 in #54
  • feat: implement std::str::FromStr for NodeType by @fs0414 in #56
  • perf: use BTreeMap index for comment lookup in emit_statements by @fs0414 in #57
  • feat: use serde enum for comment types by @fs0414 in #58

Full Changelog: v1.3.1...v1.3.2

v1.3.1

08 Jan 12:33

Choose a tag to compare

What's Changed

Added

  • Dedicated emitters for SingletonClassNode and pattern matching (CaseMatchNode, InNode)
  • Literal and pattern match node support
  • NoKeywordsParameterNode support

Changed

  • Performance: Comment lookup optimized with BTreeMap index (O(n) → O(log n))
  • Performance: HashSet for comment tracking (O(n) → O(1) contains check)
  • Performance: Cached indent strings to avoid repeated allocations

Fixed

  • DefNode parameter handling and missing node types
  • Deep nest JSON parse error (max_nesting: false)

Installation

gem install rfmt -v 1.3.1

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

What's Changed

  • ノードサポートの拡張 - パターンマッチング・シングルトンクラス対応 by @fs0414 in #32
  • Refactor: Replace Vec with HashSet for comment tracking performance by @fs0414 in #33
  • Perf: Add indent string caching and use std::mem::take for buffer return by @fs0414 in #34
  • perf: Optimize comment lookup with BTreeMap index by @fs0414 in #39

Full Changelog: v1.3.0...v1.3.1

v1.3.0

06 Jan 16:38

Choose a tag to compare

What's Changed

Added

  • Precompiled native gem support for multiple platforms:
    • Linux x86_64 (glibc and musl)
    • Linux aarch64 (glibc and musl)
    • macOS x86_64 (Intel) and arm64 (Apple Silicon)
    • Windows x64
  • Users no longer need Rust toolchain (cargo) to install rfmt
  • GitHub issue and PR templates

Changed

  • Release workflow now uses oxidize-rb/actions/cross-gem for cross-compilation
  • gemspec updated to exclude compiled artifacts from source gem

Fixed

  • CI cross-compile compatibility: Downgrade Cargo.lock to version 3 for older Cargo
  • Remove .ruby-version from repository to avoid rbenv errors in CI containers

Installation

gem install rfmt -v 1.3.0

Precompiled platforms

This release includes precompiled native gems for:

  • Linux x86_64 (glibc and musl)
  • Linux aarch64 (glibc and musl)
  • macOS x86_64 (Intel)
  • macOS arm64 (Apple Silicon)
  • Windows x64

If a precompiled gem is not available for your platform, the source gem will be installed and compiled using Cargo.

Full Changelog

See CHANGELOG.md for all changes.

What's Changed

  • GitHub Issue/PR テンプレートの追加 by @fs0414 in #29
  • プリコンパイル済みgemの配布対応 - ユーザー環境でのCargo依存を解消 by @fs0414 in #31

Full Changelog: v1.2.7...v1.3.0