Introduce LspAdapterDelegate trait, passed to LspDelegates
This commit is contained in:
parent
05d69c804c
commit
360bbebbd9
13 changed files with 243 additions and 133 deletions
|
@ -1,8 +1,7 @@
|
|||
use anyhow::{anyhow, Result};
|
||||
use async_trait::async_trait;
|
||||
use language::{LanguageServerBinary, LanguageServerName, LspAdapter};
|
||||
use language::{LanguageServerBinary, LanguageServerName, LspAdapter, LspAdapterDelegate};
|
||||
use std::{any::Any, path::PathBuf, sync::Arc};
|
||||
use util::http::HttpClient;
|
||||
|
||||
pub struct RubyLanguageServer;
|
||||
|
||||
|
@ -14,7 +13,7 @@ impl LspAdapter for RubyLanguageServer {
|
|||
|
||||
async fn fetch_latest_server_version(
|
||||
&self,
|
||||
_: Arc<dyn HttpClient>,
|
||||
_: &dyn LspAdapterDelegate,
|
||||
) -> Result<Box<dyn 'static + Any + Send>> {
|
||||
Ok(Box::new(()))
|
||||
}
|
||||
|
@ -22,13 +21,17 @@ impl LspAdapter for RubyLanguageServer {
|
|||
async fn fetch_server_binary(
|
||||
&self,
|
||||
_version: Box<dyn 'static + Send + Any>,
|
||||
_: Arc<dyn HttpClient>,
|
||||
_container_dir: PathBuf,
|
||||
_: &dyn LspAdapterDelegate,
|
||||
) -> Result<LanguageServerBinary> {
|
||||
Err(anyhow!("solargraph must be installed manually"))
|
||||
}
|
||||
|
||||
async fn cached_server_binary(&self, _container_dir: PathBuf) -> Option<LanguageServerBinary> {
|
||||
async fn cached_server_binary(
|
||||
&self,
|
||||
_: PathBuf,
|
||||
_: &dyn LspAdapterDelegate,
|
||||
) -> Option<LanguageServerBinary> {
|
||||
Some(LanguageServerBinary {
|
||||
path: "solargraph".into(),
|
||||
arguments: vec!["stdio".into()],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue