Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elixir support #556

Open
setop opened this issue Oct 23, 2024 · 4 comments
Open

Elixir support #556

setop opened this issue Oct 23, 2024 · 4 comments
Labels

Comments

@setop
Copy link
Contributor

setop commented Oct 23, 2024

I don't know how much effort it cost to support a new language.
But I'm working on a large Elixir code base and I would love to be able to Grit to refactor it reliably.

@morgante morgante changed the title Please Support Language Elixir support Oct 23, 2024
@morgante
Copy link
Contributor

Thanks for your interest! We currently prioritize languages for our commercial customers, but if you'd like to take on adding this yourself the process is described here: https://github.com/getgrit/gritql/blob/main/CONTRIBUTING.md#adding-a-new-target-language

@setop
Copy link
Contributor Author

setop commented Dec 30, 2024

I made an attempt, getting inspiration from what exists for ruby as these languages are not too far from each other.

At some point I even managed to have it compiled and passing tests.

But is fails at matching simple code:

$ cat hello.exs 
IO.puts "Hello"

$ ./target/debug/grit apply --dry-run --language=elixir '`IO.puts "Hello"` => `IO.puts "Bye"`' hello.exs
Processed 1 files and found 0 matches

whereas

$ cat hello.rb 
puts "Hello"

$ ./target/debug/grit apply --dry-run --language=ruby '`puts "Hello"` => `puts "Bye"`' hello.rb
hello.rb
    -puts "Hello"
    +puts "Bye"

@morgante
Copy link
Contributor

The problem is usually missing contexts. If you open a draft PR I'm happy to try debugging.

@setop
Copy link
Contributor Author

setop commented Dec 31, 2024

The problem is usually missing contexts.

That's indeed the part of the guide I understood the least ;)

If you open a draft PR I'm happy to try debugging.

With great pleasure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants