castwide / solargraph

A Ruby language server.
https://solargraph.org
MIT License
1.89k stars 158 forks source link

Setup LOAD_PATH from require_paths #648

Open mkon opened 1 year ago

mkon commented 1 year ago

Hey everyone, thanks for this nice gem, I am trying to incorporate it into more parts of my ruby development.

Sometimes I am using a setup where I do not want to add solargraph to the Gemfile, so I can not start it via bundle exec. However I still want a diagnoser like rubocop to be able to require files of local gems, for example custom cops provided by a local gem (with a path pointer in the local Gemfile).

Currently rubocop will just crash because it can not load those files for custom cop definitions, but with some simple change we can expose the configuration of require_files to rubocop by updating LOAD_PATH. In many cases require_files already has a working default and there is no additional configuration required.

WDYT? @castwide