gazayas / masamune-ast

A covenience wrapper around Prism, a Ruby source code parser
MIT License
13 stars 1 forks source link

Provide ERB support #70

Open gazayas opened 11 months ago

gazayas commented 11 months ago

There's an issue open at Ruby LSP about reading ERB information: https://github.com/Shopify/ruby-lsp/issues/1055

We might be able to glean some content from there to read files in masamune and return Prism nodes for the information we're looking for.

I'm specifically thinking of this BlockManipulator class which uses ERB syntax in its tests. We rely on strings now, but it would be better to rely on Prism nodes.

https://github.com/bullet-train-co/bullet_train-core/blob/e6b16c207f63f83750de33f1f7bbe6473f342748/bullet_train-super_scaffolding/lib/scaffolding/block_manipulator.rb#L161-L172

https://github.com/bullet-train-co/bullet_train-core/blob/e6b16c207f63f83750de33f1f7bbe6473f342748/bullet_train-super_scaffolding/test/lib/scaffolding/block_manipulator_test.rb#L24-L47