Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage without a Gemfile #708

Open
1 task done
boris-petrov opened this issue May 8, 2023 · 5 comments
Open
1 task done

Usage without a Gemfile #708

boris-petrov opened this issue May 8, 2023 · 5 comments
Labels
enhancement New feature or request help-wanted Extra attention is needed pinned This issue or pull request is pinned and won't be marked as stale

Comments

@boris-petrov
Copy link

I have checked that this feature is not already implemented

  • This feature does not exist

Use case

I am using Ruby via JRuby and I'm using Gradle as a build system and the JRuby Gradle Plugin to install gems and use them. I want to get 1) RuboCop warnings in VSCode (most importantly) and perhaps 2) all the other nice features of ruby-lsp. However, it seems that it requires a Gemfile for most of its functionality. The JRuby Gradle Plugin doesn't work with a Gemfile but with custom Gradle syntax.

Description

Some way of letting ruby-lsp what my gems are without them being in a Gemfile. It would also be nice to not have to duplicate that information between my Gradle file and some other place (be it a Gemfile).

Implementation

No response

@boris-petrov boris-petrov added the enhancement New feature or request label May 8, 2023
@vinistock vinistock added the help-wanted Extra attention is needed label May 25, 2023
@mateusdeap
Copy link
Contributor

I'm sorry, not sure if my comment is useful to the issue at hand, but I just wanted to confirm that this corresponds to what I encountered.

Basically, I recently tried to setup a project with ruby-lsp and, while it did have a Gemfile, I had not yet run bundle install, so when I tried to run ruby-lsp I would get this error:
image

Does this correspond to this feature request? I mean, the project does have a Gemfile, but I'm kind of assuming that the error is due to some expectation or requirement that we at least work with Gemfiles. Because, otherwise, I wanted to open an issue with this exception to see if there's a fix or not.

@boris-petrov
Copy link
Author

No, this isn't what I mean. I meant to be able to use ruby-lsp without a Gemfile file at all.

@vinistock
Copy link
Member

@mateusdeap regarding your problem, can you open a different issue for it? Please include information about your bundle setup and why there wouldn't be a Gemfile.lock.

The Ruby LSP connects to application's dependencies, such as RuboCop, so we indeed need a Gemfile.lock or else bundler wouldn't allow us to require things.

@vinistock vinistock added the pinned This issue or pull request is pinned and won't be marked as stale label Jul 20, 2023
@halilim
Copy link

halilim commented May 21, 2024

Hi, I would like to have this feature too. My use case: stand-alone Ruby files and scripts here and there with no dependencies besides the core libraries.

@e1senh0rn
Copy link

e1senh0rn commented May 23, 2024

My scenario is close to what @halilim described: I have bunch of ad-hoc scripts here and there. They are self-contained though, I use bundler/inline to handle dependencies transparently:

#!/usr/bin/env ruby

require 'rubygems'

require 'bundler/inline'
gemfile do
  source 'https://rubygems.org'
  gem 'slop'
end

# ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help-wanted Extra attention is needed pinned This issue or pull request is pinned and won't be marked as stale
Projects
None yet
Development

No branches or pull requests

5 participants