[Question] What LSP Are You Using? - eviltoast
  • sickday@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    3 months ago

    I used solargraph for a really long time and it mostly suited all my needs, but I’ve seen it chew through memory in resource-bound environments (laptops with > 8GB RAM). Solargraph is very mature and is actively developed as of today. I’d say it’s still a very fine choice for anyone needing some LSP features in a text editor.

    Personally, I switched to ruby-lsp some time back and haven’t needed anything else but my requirements aren’t the norm. I spend a lot of time in a terminal with tmux, vim/helix (which has ootb support for solargraph), and a handful of monitoring tools.

    Overall, I would say solargraph should fit the bill for most users. Ruby-LSP is great if solargraph isn’t cutting it for you in some way.

    • occultist8128@infosec.pubOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      3 months ago

      i also use solargraph and ruby-lsp but i’m facing an issue with this code i wrote:

      # frozen_string_literal: true
      
      array_of_strings = %w[foo fooo bar fioo]
      oo = array_of_strings.select { |word| word.end_with?('oo') }
      puts oo
      

      when i want to use end_with? method, both LSP don’t show any method for the word variable. do you know why is this happen? i also use neovim with coc.nvim for the LSP plugin. thanks for the reply btw :)

      • sickday@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        3 months ago

        Interesting. I’ve had this issue before and I’ve concluded that both LSP gems don’t really have a great solution to this problem. It crops up for me in both some code blocks and nested blocks. The solargraph maintainers have provided a solution for user-defined Classes here, but that’s not really applicable in your case.

        Being frank, I would open an issue with both LSPs with your code example to get a better idea of what’s actually going on here and what potential solutions you can explore. Sorry I couldn’t offer more insight here

        • occultist8128@infosec.pubOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          3 months ago

          ahh thanks. might as well post this on reddit tho. ur reply made me really love ruby community here and reddit cuz u guys are helping and supportive <3

    • sickday@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      3 months ago

      RubyMine is an Interactive Development Environment, not a Language Server Protocol. RubyMine doesn’t need to use an LSP since it has all the features an LSP offers (and more) built into to the environment.

    • occultist8128@infosec.pubOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      3 months ago

      can RubyMine completion shows the method for word variable here?

      # frozen_string_literal: true
      
      array_of_strings = %w[foo fooo bar fioo]
      oo = array_of_strings.select { |word| word.end_with?('oo') }
      puts oo
      

      for example the end_with? method cuz with both solargraph and ruby-lsp they don’t show any suggestions for the word variable at all.

        • occultist8128@infosec.pubOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          3 months ago

          now i’m confused about why solargraph, which is said to be mature, can’t do that. and also i just realized it when i used map instead of select; the methods appeared.

          wanna try RubyMine but i already comfortable in neovim. since RubyMine is an IDE i think my machine can’t handle that lol.

          • sickday@programming.dev
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            3 months ago

            now i’m confused about why solargraph, which is said to be mature, can’t do that

            It’s important to note that ruby-lsp is made by Shopify, and is currently used in-house by the company. The resources they can invest into ruby-lsp both in terms of development man-power and project management is naturally going to be higher than the community developed solargraph.

            and also i just realized it when i used map instead of select; the methods appeared.

            That’s strange, but Enumerable#map and Enumerable#select have different uses. One is used to execute a block across a collection of elements, while the other constructs a new collection based on the block passed to a collection and the results of evaluating that block against each element.

            wanna try RubyMine but i already comfortable in neovim. since RubyMine is an IDE i think my machine can’t handle that lol.

            I use RubyMine on my desktop and it’s a very solid development experience. I’ll say that if your machine can’t quite handle RubyMine, VS Code(ium) is a nice alternative with the solargraph or ruby-lsp plugins. I don’t know if they’ll have the same completion issue as neovim though.