mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-20 15:40:29 +01:00
75775292b3
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>
20 lines
538 B
Rust
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)
|
|
}
|
|
}
|