Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ license = "Apache-2.0"
path = "src/ruby.rs"
crate-type = ["cdylib"]

[features]
default = []
command_api = []

[dependencies]
regex = "1.11.1"
serde_json = "1.0"
Expand Down
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# Ruby extension for Zed

[Documentation](https://zed.dev/docs/languages/ruby)

## Command-free LSP build

The default build does not run extension-side process commands for Ruby LSP
startup. It uses configured `lsp.<server>.binary.path` values first, then falls
back to `worktree.which`. If `use_bundler` is enabled, it launches through
`bundle exec <server>` without probing Bundler.

```sh
cargo test
```

To enable the command API path for project gem detection and extension-managed
language server/debug gem installation, build with:

```sh
cargo test --features command_api
```

This is not a replacement for fixing Zed's command spawning behavior:
https://github.com/zed-industries/zed/issues/57170. The command-free profile
expects `bundle` or the language server executable to be available from the
project environment. Debugging expects `rdbg` to be available from that same
environment.
2 changes: 2 additions & 0 deletions src/command_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ pub trait CommandExecutor {

/// An implementation of `CommandExecutor` that executes commands
/// using the `zed_extension_api::Command`.
#[cfg(feature = "command_api")]
#[derive(Clone)]
pub struct RealCommandExecutor;

#[cfg(feature = "command_api")]
impl CommandExecutor for RealCommandExecutor {
fn execute(
&self,
Expand Down
9 changes: 9 additions & 0 deletions src/language_servers/kanayago.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ impl LanguageServer for Kanayago {
const EXECUTABLE_NAME: &str = "kanayago";
const GEM_NAME: &str = "kanayago";

fn default_use_bundler() -> bool {
false
}

fn get_executable_args<T: WorktreeLike>(&self, _worktree: &T) -> Vec<String> {
vec!["--lsp".to_string()]
}
Expand Down Expand Up @@ -39,4 +43,9 @@ mod tests {

assert_eq!(kanayago.get_executable_args(&mock_worktree), vec!["--lsp"]);
}

#[test]
fn test_default_use_bundler() {
assert!(!Kanayago::default_use_bundler());
}
}
Loading