this post was submitted on 31 Aug 2024
4 points (100.0% liked)

Ruby

533 readers
1 users here now

A community for discussion and news about Ruby programming.

Learning Ruby?

Tools

Documentation

Books

Screencasts

News and updates

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 2 months ago* (last edited 2 months ago) (1 children)

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 2 points 2 months ago (1 children)

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

[–] [email protected] 2 points 2 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