Janko Marohnić
janko.io
Janko Marohnić
@janko.io
200 followers 110 following 170 posts
Senior Ruby engineer, father, vegan. Creator of Shrine, rodauth-rails and vim-test.
Posts Media Videos Starter Packs
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" 🤞
Reposted by Janko Marohnić
What comes through loud and clear from Shan is the lack of respect for open source authors. She actually says it’s none of my business why I was removed from rubygems. I don’t know where you got the audacity but you should put it back. youtu.be/nKpo68g9dEk?...
Technology for Humans: Shan Cureton
YouTube video by reinteractive
youtu.be
We're using Chamber for application secrets/settings at work, and probably the only that's keeping me from switching to Rails credentials is the ability to override any value with an environment variable.

That's really a killer feature, both Chamber and AnyConfig support it.
So, the reason why project symbol search isn't working reliably in Zed is that Ruby LSP:

1. returns malformed results for method aliases
2. doesn't support request cancellation (Zed doesn't debounce atm)
3. searches gems as well, which is 3.5x slower, and adds up because of 2.
The 37signals team must be patting themselves on the back during this AWS outage 😄
I started by feeding RPC messages between Zed and stimulus-language-server into Claude Code, which successfully reproduced the bug with a Node script, taking Zed out of the equation.

From there it was able to find the stimulus-parser bug, so I could eliminate LSP as well 😌