standardrb / vscode-standard-ruby

The official VS Code extension for the Standard Ruby linter and code formatter
Other
101 stars 7 forks source link

Can't start Standard Ruby LSP when clicking on GUI icon #10

Closed jperna7254 closed 1 year ago

jperna7254 commented 1 year ago

In my current setup I can get Standard Ruby working fine only if I execute code . from within the root of my project repo. However, I cannot get the language server running if I click on the GUI Visual Studio Code icon from Finder or my Desktop. If I open VSC with the code . command, then just close the window, and then click on the VSC icon it works. However, if you have quit VSC completely and then click on the Finder icon or the Desktop icon I get the following error.

[client] Command `bundle list --name-only` failed with exit code 1 (exec options: {"cwd":"/Users/jeremyperna/dev/data_service_server"})
[client] stderr:
Could not find faraday-0.17.6, flipper-0.28.0, flipper-active_support_cache_store-0.28.0, flipper-redis-0.28.0, mysql2-0.5.5, oj-3.14.3, psych-3.3.4, rails-6.0.6.1, resque-2.5.0, resque-scheduler-4.8.0, sorted_set-1.0.3, database_cleaner-2.0.2, brakeman-5.4.1, standard-1.28.2, railties-6.0.6.1, activerecord-6.0.6.1, actionpack-6.0.6.1, activesupport-6.0.6.1, aws-sdk-core-3.171.0, redis-5.0.6, actioncable-6.0.6.1, actionmailbox-6.0.6.1, actionmailer-6.0.6.1, actiontext-6.0.6.1, actionview-6.0.6.1, activejob-6.0.6.1, activemodel-6.0.6.1, activestorage-6.0.6.1, redis-namespace-1.10.0, sinatra-3.0.5, rufus-scheduler-3.8.2, rbtree-0.4.6, set-1.0.3, aws-sdk-sts-1.9.0, database_cleaner-active_record-2.1.0, lint_roller-1.0.0, rubocop-1.50.2, standard-custom-1.0.0, standard-performance-1.0.1, zeitwerk-2.6.7, aws-partitions-1.745.0, redis-client-0.14.0, mail-2.8.0.1, nokogiri-1.14.2, sprockets-4.2.0, mustermann-3.0.0, rack-protection-3.0.5, fugit-1.8.1, parallel-1.23.0, parser-3.2.2.1, regexp_parser-2.8.0, rubocop-ast-1.28.1, unicode-display_width-2.4.2, rubocop-performance-1.16.0, connection_pool-2.4.0, mini_portile2-2.8.1 in locally installed gems nor data_record-9.4.1, dynamo_client-1.5.1, vendor_api_client-8.0.0, gem_versioner-1.0.0, logger-1.2.8 in locally installed gems
Install missing gems with `bundle install`.
[client] Failed to invoke Bundler in the current workspace. After resolving the issue, run the command `Standard Ruby: Start Language Server`

Successful run whenever I run code . from root of my project repo

[client] Starting language server: standardrb --lsp
[server] Standard Ruby v1.28.2 LSP server initialized, pid 34220
searls commented 1 year ago

That's not good! Naturally, I'm unable to replicate this on my machine.

Could you please share your OS details, standard-related user settings & workspace settings, and VSCode version details.

If I had to guess what you're experiencing, it's that you may have the extension configured to run only via Bundler:

Screenshot 2023-05-15 at 10 01 00 AM

And when you open VS Code through the GUI without a project loaded, unless you hit ctrl-R to load a project folder as a "workspace", the extension will not be able to see a Gemfile in the package root and therefore may not be running correctly.

This is something I may be able to work around in the extension to make the experience more pleasant, but only once I can reproduce it

jperna7254 commented 1 year ago

Changing the setting to run always whether via bundler or globally fixed the issue. Thank you!