Janko Marohnić
janko.io
Janko Marohnić
@janko.io
210 followers 110 following 180 posts
Senior Ruby engineer, father, vegan. Creator of Shrine, rodauth-rails and vim-test.
Posts Media Videos Starter Packs
Well, in my experience AI can’t write decent tests 😛

It doesn’t seem to think of reusing factories/fixtures, at least not fully.
Even with Bundler checksums enabled? 🙂

We only have paid gems vendored for conveniece (Sidekiq/graphql-ruby Pro). But I always wished they waren’t commited to source control, because I want to treat them as external.
Reposted by Janko Marohnić
Also coming in Herb v0.8.0, the long awaited Tailwind CSS class sorting feature in the Herb Formatter! 🌿

Here is a demo of that working in @zed.dev using the new `.herb.yml` configuration file! 😍
How is that different from installing gems? Why don’t we vendor gems then?
That part where I need to commit source code for a 3rd-party package into version control.
OK, I guess Sorbet also does dynamic typechecking then.

What would you dislike about moving those type annotations into comments? I feel like you’d still write similar amount of code, unlike with RBS header files where you need to repeat method and class definitions.
I can’t accept importmap-rails downloading and vendoring JS packages. I feel like I’m back in the pre-Sprockets era.
I watched the demo, and while impressive, I would like to not have a different method syntax.

Also, inline RBS supports static typechecking from what I understand, while I imagine this is only for runtime typechecking.

I also don’t like the look of those leading underscores 🙈
I haven’t personally experienced many issues with environments differing, so it’s not a problem I’m eager to have solved.
Reposted by Janko Marohnić
I'm excited to share that I became a Ruby committer today! A 10 year goal since RubyKaigi 2015.
Huge thanks to @bernsteinbear.com for the JIT mentorship and nomination, @k0kubun.com for years of guidance, and everyone who supported me along the way.
Looking forward to improving Ruby and its DX!
It reminds me of me with HTTP/2, where by the time I started getting it and looking how to support it, h3 had already came out 😄
Inline RBS is the only gradual typing for Ruby I can get behind.

Sorbet’s RBI was way too verbose, as it had to be valid Ruby, but at least it was inline. RBS was more compact, but required separate files.

Inline RBS is just comments, and I imagine it has advantages over YARD.
To be clear, I'm referring to `ActionController::Base._prefixes` method. It's technically public, but the name indicates it maybe shouldn't be used.
It seems I will do that in Ruby LSP land after all. I couldn't think of a sane interface for retrieving view prefixes from controller, and `_prefixes` seems kind of like private API anyway.
Given that retrieving arguments of a `render` call is fairly easy, it makes sense for me that both Ruby LSP Rails and Herb do it, just for different purposes.

Ruby LSP Rails would use it to follow partial names, while Herb would use it for linting. So, I imagine them having different code.
Absolutely, linting sounds like it should live entirely in the Herb language server. AFAIK Ruby LSP doesn't have knowledge of where we are in the ERB file.

Prism nodes contain location info, but I would assume they don't point to the actual location in the template.
Yeah, that sounds useful in scenarios where "go to definition" should lead to specific part of the HTML+ERB template.

In my case, I just link to the start of the partial file.
I like that Ruby LSP abstracts ERB away from me, so I only need to check the file extension. This could then theoretically work in pure Ruby templates as well, and possibly jbuilder, it's not tied to HTML+ERB files.

Is there an advantage of doing it within Herb?
I'm actually trying to do that for the remaining component – controller inheritance chain. Rails allows rendering partials from any ancestor directory, and I thought it's best to ask Rails for the directory list.

It can be composed with static analysis, but I'm missing AS inflector methods.
Like, this actually works 🤯
There are surprisingly many aspects to handle:

* positional or keyword (:partial) argument
* relative vs absolute paths
* layout partials
* spacer templates
* ERB template rendering non-ERB partial (e.g. Slim)
* controller inheritance chain
* variants
It seems I've developed a newfound interest for language servers 🙂

They have just unlocked for me recently. It started with a contribution to Stimulus LSP, afterwards I wanted to fix issues I've been experiencing with Ruby LSP.

Kudos to Shopify for solving difficult problems like indexing 🙇‍♂️
With all Ruby LSP fixes for workspace symbol search underway, I would like to take a stab at adding a new feature.

Rails.vim had a neat feature where you can follow render calls in view templates via `gf`. I'm exploring adding the same feature to Ruby LSP Rails via "go to definition" 🤞