Add ability to specify binary path/args for rust-analyzer (#9293)
This fixes #9292 by adding a section to the language server settings that allows users to specify the binary path and arguments with which to start up a language server. Example user settings for `rust-analyzer`: ```json { "lsp": { "rust-analyzer": { "binary": { "path": "/Users/thorstenball/tmp/rust-analyzer-aarch64-apple-darwin", "arguments": ["--no-log-buffering"] } } } } ``` Constraints: * Right now this only allows ABSOLUTE paths. * This is only used by `rust-analyzer` integration right now, but the setting can be used for other language servers. We just need to update the adapters to also respect that setting. Release Notes: - Added ability to specify `rust-analyzer` binary `path` (must be absolute) and `arguments` in user settings. Example: `{"lsp": {"rust-analyzer": {"binary": {"path": "/my/abs/path/rust-analyzer", "arguments": ["--no-log-buffering"] }}}}` ([#9292](https://github.com/zed-industries/zed/issues/9292)). Co-authored-by: Ricard Mallafre <rikitzzz@gmail.com>
This commit is contained in:
parent
6655b964ab
commit
a56a260778
38 changed files with 92 additions and 43 deletions
|
@ -282,7 +282,7 @@ pub trait LspAdapterDelegate: Send + Sync {
|
|||
async fn read_text_file(&self, path: PathBuf) -> Result<String>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
#[async_trait(?Send)]
|
||||
pub trait LspAdapter: 'static + Send + Sync {
|
||||
fn name(&self) -> LanguageServerName;
|
||||
|
||||
|
@ -306,7 +306,7 @@ pub trait LspAdapter: 'static + Send + Sync {
|
|||
// We only want to cache when we fall back to the global one,
|
||||
// because we don't want to download and overwrite our global one
|
||||
// for each worktree we might have open.
|
||||
if let Some(binary) = self.check_if_user_installed(delegate.as_ref()).await {
|
||||
if let Some(binary) = self.check_if_user_installed(delegate.as_ref(), cx).await {
|
||||
log::info!(
|
||||
"found user-installed language server for {}. path: {:?}, arguments: {:?}",
|
||||
language.name(),
|
||||
|
@ -380,6 +380,7 @@ pub trait LspAdapter: 'static + Send + Sync {
|
|||
async fn check_if_user_installed(
|
||||
&self,
|
||||
_: &dyn LspAdapterDelegate,
|
||||
_: &AsyncAppContext,
|
||||
) -> Option<LanguageServerBinary> {
|
||||
None
|
||||
}
|
||||
|
@ -1457,7 +1458,7 @@ impl Default for FakeLspAdapter {
|
|||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
#[async_trait]
|
||||
#[async_trait(?Send)]
|
||||
impl LspAdapter for FakeLspAdapter {
|
||||
fn name(&self) -> LanguageServerName {
|
||||
LanguageServerName(self.name.into())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue