reddit / emacs

Emacs and Rails

pedzsanReddit 路 2022-09-28 21:11
The title should give you a good clue what my question is. I'm getting back into Ruby on Rails and looking for emacs packages that help support working on a Rails project. The last time I was seriously doing Rails was 2010 or so. emacs-rails and emails-rails-rebooted seem dead. The Emacs wiki wasn't much help. I have notes about using web-mode but the code is commented out as if I tried it and didn't like it. I know about rspec-mode and will likely use that again.
dybbuk12 路 2022-09-28 21:41
Definitely give web-mode another try. I have been really happy with it for all kinds of HTML and template editing. Have you tried out the Emacs LSP stuff yet? You might want to see if that works well with Ruby on Rails.
pedzsanReddit 路 2022-09-28 22:36
| Have you tried out the Emacs LSP stuff yet? OMG... This looks like an infinite pit of questions... 馃ぃ One Ruby add on is Solargraph which talks about Rails. I'm going to go exploring. If I don't come back, tell mamma I love her. And I'll give web-mode another whirl as well. I'm also investigating Projectile that has a lot of additions.
dybbuk12 路 2022-09-28 22:38
Yes, Projectile is amazing! You also may want to check out Treemacs. Note that LSP works great for JavaScript, Sass, and CSS files, too.
pedzsanReddit 路 2022-09-29 01:26
Update... I should have mentioned this before. My emacs is on my Mac laptop but my Rails project is inside a Docker container.
takeonrules 路 2022-09-29 02:19
My primary professional language is Ruby. Here's my four configurations related to Ruby/Rails. For awhile I used a Rails projectile project, but found `(projectile-toggle-between-implementation-and-test)` to be mostly what I needed. - enh-ruby-mode :: https://github.com/jeremyf/dotemacs/blob/main/emacs.d/configuration.org#enh-ruby-modeel - eglot :: https://github.com/jeremyf/dotemacs/blob/main/emacs.d/configuration.org#eglotel - rspec-mode :: https://github.com/jeremyf/dotemacs/blob/main/emacs.d/configuration.org#rspec-modeel - ruby-interpolation :: https://github.com/jeremyf/dotemacs/blob/main/emacs.d/configuration.org#ruby-interpolationel
paretoOptimalDev 路 2022-09-29 03:14
Docker container with no external volume? Use eglot through tramp for that. I'm not sure if lsp-mode works over tramp.
pedzsanReddit 路 2022-09-29 13:11
I'm trying to figure that out right now. There is [lsp-docker](https://github.com/emacs-lsp/lsp-docker) which is designed (I'm still half guessing) to have a separate container hold the language server. What I want is a pre-existing container to hold the server. There is partial code in that repo to do that but it appears not fully baked. Re: eglot: I've glommed on to lsp-mode and heading that path but I've discovered that a few (a previous comment) points to eglot. I'm wondering what are the differences and if I should switch horses. In my case, I'm using docker compose with two containers. One is the db and one is the rails app. The rails app container mounts the laptop's file system into the container. So, the interesting code is both on the laptop and mounted into the container. But the Ruby gems are inside the container only.
pedzsanReddit 路 2022-09-29 13:28
I'm exploring your dotemacs Org file and it referenced a post and that post mentioned your desired for "Fuzzy File Opening". If you are still looking for that, you might check out [Helm](https://emacs-helm.github.io/helm/). For me, it has been and still is VERY hard to adopt to. My muscle memory is to hit tab to expand what I've typed so far and in Helm, that doesn't work. But if you can use it like it was designed to be used, it is really nice.
takeonrules 路 2022-09-29 13:44
Thanks for the tip. I've not used helm. So far I think my fuzzy file opening might be a want that I've forgotten or now work around
paretoOptimalDev 路 2022-09-29 13:50
You could also write a Ruby wrapper calling `docker compose myContainer ruby` and pointing lsp-mode to use it.
StMonty 路 2022-09-30 06:12
I work on a large rails project with Emacs and I had a lot of trouble with Eglot and LSP mode with Solargraph, and decided to try [Robe](https://github.com/dgutov/robe) and it has been working well for me the past few days edit: eglot has worked really well with other languages I like to use like C, Haskell, and Rust for example though