rfmt 1.5.3-aarch64-linux → 1.6.0-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d82f09486291a07109b0fdc54c23899b3e9c077cb38109fc547a0e565c59cb29
4
- data.tar.gz: f63b715d048236b81484a0fcd46d1fe7b4cfa995ac91f3aebd94f3999ce4b351
3
+ metadata.gz: 6aa4ee193a6d3771e9fdf0c73c7bd930640e8aacbf01656c21a40392c9ea6304
4
+ data.tar.gz: b3449cbc83b606d8d13bf8e9235f02a1f6b6e7441e55dcfd50de4c1e14b8139e
5
5
  SHA512:
6
- metadata.gz: edc982a72084c9b06334d1c9f3a78d50774ecd0275d0f6fb427c63f56d3c4b99cf2d7c6c3dd227c8a4188769299f0d96b61cad38fbdba2452dd1234d2aeaf209
7
- data.tar.gz: aade66d5d03618a45d203c9adc5b83bef8b67aafdce56021bb2982a77b7ed64b82b56a25c25f2b506068f04841bb0bab26908606d463bfe34fd357f2162757c9
6
+ metadata.gz: 926ea7ec34c5cab902782f7d94313b7c66515e5763d65a4d493be558416e137a09cb2c94c90b92a93fa74c21df38b59466fa7cf807f37a0693dea53946eb2263
7
+ data.tar.gz: 8c7d31435fa536fc516243869de9c2f37f910a5dbfd280a7c613e9bf3b7db8b1fe9429800bbaf8844a432457d26087b515a6429594b2dcce46e8b3600f49bbeb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.6.0] - 2026-04-23
4
+
5
+ ### Added
6
+ - **Rule-based formatter architecture**: new modular `format/` pipeline (`Formatter`, `Registry`, `Rule`) replacing the legacy monolithic emitter
7
+ - **Intermediate Representation (IR) module**: decouples parsing from emission for composability and testability
8
+ - New formatter rules: `StatementsRule` (body indentation), `SingletonClassRule`, `VariableWriteRule`
9
+ - Method chain reformatting: convert aligned style to indented style when lines exceed the configured width
10
+ - Chain reformatting wired into the fallback path for resilience
11
+ - `config` module exported for test consumption
12
+ - **Editor Integration Documentation**: comprehensive setup guides for VSCode, Neovim, Helix, Emacs, and Zed
13
+ - VSCode: Format on Save configuration with Ruby LSP, settings reference table, project-specific setup
14
+ - Zed: full configuration with `initialization_options` and `format_on_save`
15
+ - All editors work through the Ruby LSP addon system — no editor-specific plugins required
16
+ - README: Editor Integration section updated with VSCode quick start (replacing "Coming Soon")
17
+
18
+ ### Changed
19
+ - Printer optimized with indent cache and inline hints
20
+ - `reformat_chain_lines` deduplicated across rules and optimized with `Cow` to reduce allocations
21
+ - README: Neovim integration updated from CLI-based to Ruby LSP-based approach
22
+ - Removed Sublime Text section from editor documentation (replaced by Zed)
23
+
24
+ ### Fixed
25
+ - Prism comment JSON deserialization now accepts `comment_type` and `embdoc` fields (#97)
26
+ - BTreeMap range panic when computing comment indices on edge inputs
27
+ - Comment duplication during source extraction
28
+ - Empty source input handled gracefully by the formatter runner
29
+ - Clippy warnings: use `repeat_n`
30
+
31
+ ### Removed
32
+ - Legacy `Emitter` module (1844 LOC) — superseded by the new `Formatter`
33
+
3
34
  ## [1.5.3] - 2026-02-22
4
35
 
5
36
  ### Changed
data/README.md CHANGED
@@ -361,30 +361,34 @@ end
361
361
 
362
362
  ## Editor Integration
363
363
 
364
- ### Neovim
364
+ rfmt integrates with editors through [Ruby LSP](https://shopify.github.io/ruby-lsp/). For detailed setup instructions, see [Editor Integration Guide](docs/editors.md).
365
+
366
+ ### VSCode (Quick Start)
365
367
 
366
- Format Ruby files on save using autocmd:
368
+ 1. Install [Ruby LSP extension](https://marketplace.visualstudio.com/items?itemName=Shopify.ruby-lsp)
369
+ 2. Add to your `settings.json`:
370
+
371
+ ```json
372
+ {
373
+ "rubyLsp.formatter": "rfmt",
374
+ "editor.formatOnSave": true,
375
+ "[ruby]": {
376
+ "editor.defaultFormatter": "Shopify.ruby-lsp"
377
+ }
378
+ }
379
+ ```
380
+
381
+ ### Neovim
367
382
 
368
383
  ```lua
369
- -- ~/.config/nvim/init.lua
370
-
371
- vim.api.nvim_create_autocmd("BufWritePre", {
372
- pattern = { "*.rb", "*.rake", "Gemfile", "Rakefile" },
373
- callback = function()
374
- local filepath = vim.fn.expand("%:p")
375
- local result = vim.fn.system({ "rfmt", filepath })
376
- if vim.v.shell_error == 0 then
377
- vim.cmd("edit!")
378
- end
379
- end,
384
+ require("lspconfig").ruby_lsp.setup({
385
+ init_options = {
386
+ formatter = "rfmt"
387
+ }
380
388
  })
381
389
  ```
382
390
 
383
- ### Coming Soon
384
-
385
- - **VS Code** - Extension in development
386
- - **RubyMine** - Plugin in development
387
- - **Zed** - Extension in development
391
+ See [Editor Integration Guide](docs/editors.md) for Helix, Emacs, Sublime Text, and more.
388
392
 
389
393
  ## Development
390
394
 
data/lib/rfmt/3.3/rfmt.so CHANGED
Binary file
data/lib/rfmt/3.4/rfmt.so CHANGED
Binary file
data/lib/rfmt/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rfmt
4
- VERSION = '1.5.3'
4
+ VERSION = '1.6.0'
5
5
  end
@@ -10,6 +10,8 @@ module RubyLsp
10
10
  # @return [String, nil] Formatted text or nil on error
11
11
  def run_formatting(_uri, document)
12
12
  source = document.source
13
+ return "\n" if source.empty?
14
+
13
15
  ::Rfmt.format(source)
14
16
  rescue ::Rfmt::Error
15
17
  nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfmt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.6.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - fujitani sora
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-22 00:00:00.000000000 Z
11
+ date: 2026-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs