rufo icon indicating copy to clipboard operation
rufo copied to clipboard

Does not work when trying to rufoize code with pattern matching (ruby 2.7)

Open rindek opened this issue 4 years ago • 3 comments

When trying to run rufo against code that has pattern matching, rufo results in error

 ➭ rufo -c /tmp/test.rb
You've found a bug!
It happened while trying to format the file /tmp/test.rb

Example code in question (with use of dry-monads gem):

require "dry/monads/all"

case Dry::Monads::Maybe(nil)
in Dry::Monads::Some(x)
  puts x
in Dry::Monads::None
  puts "2"
end

It does not work as well for "simple" matching, such as:

a = 1

case a
  in 1
    puts '1'
  in 2
    puts '2'
end

Are there plans to include support for pattern matching?

rindek avatar Jul 02 '20 11:07 rindek

Hey @gingermusketeer do you know maybe if there are plans to include pattern matching syntax to rufo?

rindek avatar Aug 31 '20 14:08 rindek

@rindek It will definitely be included at some point. Can you submit a PR with a failing test and I will take a look when I get a moment.

gingermusketeer avatar Sep 10 '20 10:09 gingermusketeer

@gingermusketeer I've added couple tests, hope they are correct - see #250

rindek avatar Sep 10 '20 12:09 rindek