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

Zed editor using default rubocop settings #608

Open
LucasKuhn opened this issue Feb 19, 2024 · 5 comments
Open

Zed editor using default rubocop settings #608

LucasKuhn opened this issue Feb 19, 2024 · 5 comments

Comments

@LucasKuhn
Copy link

LucasKuhn commented Feb 19, 2024

When using Zed editor, the installation of standard for some reason is picking up only the default rubocop configuration:
image
What I believe is happening, is that bundle installs rubocop, and Zed is only using vanilla rubocop.

[edit]
As a temporary workaround I'm running standardb rules via rubocop by changing my project's .rubocop.yml , and that seems to work
image
If anyone manages to get it working properly on Zed, please follow up

@Otterpocket
Copy link

@LucasKuhn I didn't know you could even get Zed to display inline standardrb hints, I tried and failed, even using the workaround. Could share your Zed config please?

@LucasKuhn
Copy link
Author

LucasKuhn commented Mar 3, 2024

Did you run bundle install after adding the gems?
The inline hints come from the ruby LSP already provided by Zed, Solargraph ( https://github.com/zed-industries/zed/blob/main/docs/src/languages/ruby.md )
This is my ~/.config/zed

// Zed settings
//
// For information on how to configure Zed, see the Zed
// documentation: https://zed.dev/docs/configuring-zed
//
// To see all of Zed's default settings without changing your
// custom settings, run the `open default settings` command
// from the command palette or from `Zed` application menu.
{
  // "format_on_save": "off",
  "vim_mode": false,
  "ui_font_size": 16,
  "buffer_font_size": 16,
  "lsp": {
    "solargraph": {
      "initialization_options": {
        "diagnostics": true,
        "formatting": true
      }
    }
  },
  "language_overrides": {
    "ERB": {
      "formatter": {
        "external": {
          "command": "erb-format",
          "arguments": ["--stdin", "--print-width", "120"]
        }
      }
    }
  }
}

And this is what I'm currently using on my project's .rubocob.yml

inherit_mode:
  merge:
    - Exclude

require:
  - standard
  - standard-custom
  - standard-performance
  - rubocop-performance
  - rubocop-rails

inherit_gem:
  standard: config/base.yml
  standard-performance: config/base.yml
  standard-custom: config/base.yml
  standard-rails: config/base.yml

AllCops:
  Exclude:
    - "**/*.erb"
  SuggestExtensions: false

@vitallium
Copy link

Hey! Sorry for being late but the option to run standard in LSP mode instead of rubocop will be available soon in Zed - zed-extensions/ruby#25 Thanks!

@stephannv
Copy link

I'm using this zed config to run standardrb with ruby-lsp:

  "languages": {
    "Ruby": {
      "language_servers": ["ruby-lsp", "!solargraph", "!rubocop"],
      "formatter": "language_server",
      "format_on_save": "on"
    }
  },
  "lsp": {
    "ruby-lsp": {
      "initialization_options": {
        "enabledFeatures": {
          "diagnostics": false,
          "formatting": true
        },
        "formatter": "standard"
      }
    }

@stephannv
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants