Lazuli is a port (kind of!) of Chlorine, for the Clojure language. It aims to bring the features of Chlorine to the Ruby language - basically, semanti

lazuli

submited by
Style Pass
2024-09-23 01:00:05

Lazuli is a port (kind of!) of Chlorine, for the Clojure language. It aims to bring the features of Chlorine to the Ruby language - basically, semantic autocomplete and go to var definition using runtime information (that is, a code that is running) instead of relying on static analysis that might miss most cases, like dynamic definition of methods using has_many, belongs_to, or even by defining routes in Rails

Lazuli connects to nrepl-lazuli and uses runtime info to evaluate code inside the editor. It also adds some semantic information like where some method was defined, trying to avoid going to the first definition (which usually is just a Gem or other library) and matching the actual user's code (as it's possible to see in the example below, where Go To Var Definition goes to has_many and to the actual routes.rb). It also adds semantic autocomplete, meaning that it uses runtime info to actually run code to complete stuff (that might be dangerous if one of the code is trying to remove a file, for example, so use it with caution).

Lazuli traces your code to check where a method was called, and then keeps a binding of it. You can check these traces in the "Trace" section of the "Lazuli REPL" tab, and filter by typing parts of a filename (like controller for example). The traces are shown in the order they were executed - so if you visted a "Users List" page in Rails, it'll probably have a trace like users_controller.rb > user.rb > index.html.erb.

Leave a Comment
Related Posts