Files
zed/extensions/ruby/src/language_servers/rubocop.rs
T
Vitaly Slobodin 75775292b3 ruby: Add support for "rubocop" language server (#14661)
Hi, this pull request adds support for `rubocop` language server. I
noticed that `ruby-lsp` LS is becoming more popular but it still lacks
diagnostics support in Zed. To cover that missing feature, it could be
good to use `rubocop` LS to show diagnostics alongside with the running
Ruby LSP.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-07-17 17:29:42 -04:00

20 lines
538 B
Rust

use zed_extension_api::{self as zed, Result};
pub struct Rubocop {}
impl Rubocop {
pub const LANGUAGE_SERVER_ID: &'static str = "rubocop";
pub fn new() -> Self {
Self {}
}
pub fn server_script_path(&mut self, worktree: &zed::Worktree) -> Result<String> {
let path = worktree.which("rubocop").ok_or_else(|| {
"rubocop must be installed manually. Install it with `gem install rubocop` or specify the 'binary' path to it via local settings.".to_string()
})?;
Ok(path)
}
}