|
|
@ -647,6 +647,7 @@ impl Registry {
|
|
|
|
language_config: &LanguageConfiguration,
|
|
|
|
language_config: &LanguageConfiguration,
|
|
|
|
doc_path: Option<&std::path::PathBuf>,
|
|
|
|
doc_path: Option<&std::path::PathBuf>,
|
|
|
|
root_dirs: &[PathBuf],
|
|
|
|
root_dirs: &[PathBuf],
|
|
|
|
|
|
|
|
enable_snippets: bool,
|
|
|
|
) -> Result<Option<Arc<Client>>> {
|
|
|
|
) -> Result<Option<Arc<Client>>> {
|
|
|
|
let config = match &language_config.language_server {
|
|
|
|
let config = match &language_config.language_server {
|
|
|
|
Some(config) => config,
|
|
|
|
Some(config) => config,
|
|
|
@ -661,8 +662,14 @@ impl Registry {
|
|
|
|
// initialize a new client
|
|
|
|
// initialize a new client
|
|
|
|
let id = self.counter.fetch_add(1, Ordering::Relaxed);
|
|
|
|
let id = self.counter.fetch_add(1, Ordering::Relaxed);
|
|
|
|
|
|
|
|
|
|
|
|
let NewClientResult(client, incoming) =
|
|
|
|
let NewClientResult(client, incoming) = start_client(
|
|
|
|
start_client(id, language_config, config, doc_path, root_dirs)?;
|
|
|
|
id,
|
|
|
|
|
|
|
|
language_config,
|
|
|
|
|
|
|
|
config,
|
|
|
|
|
|
|
|
doc_path,
|
|
|
|
|
|
|
|
root_dirs,
|
|
|
|
|
|
|
|
enable_snippets,
|
|
|
|
|
|
|
|
)?;
|
|
|
|
self.incoming.push(UnboundedReceiverStream::new(incoming));
|
|
|
|
self.incoming.push(UnboundedReceiverStream::new(incoming));
|
|
|
|
|
|
|
|
|
|
|
|
let old_clients = entry.insert(vec![(id, client.clone())]);
|
|
|
|
let old_clients = entry.insert(vec![(id, client.clone())]);
|
|
|
@ -695,6 +702,7 @@ impl Registry {
|
|
|
|
language_config: &LanguageConfiguration,
|
|
|
|
language_config: &LanguageConfiguration,
|
|
|
|
doc_path: Option<&std::path::PathBuf>,
|
|
|
|
doc_path: Option<&std::path::PathBuf>,
|
|
|
|
root_dirs: &[PathBuf],
|
|
|
|
root_dirs: &[PathBuf],
|
|
|
|
|
|
|
|
enable_snippets: bool,
|
|
|
|
) -> Result<Option<Arc<Client>>> {
|
|
|
|
) -> Result<Option<Arc<Client>>> {
|
|
|
|
let config = match &language_config.language_server {
|
|
|
|
let config = match &language_config.language_server {
|
|
|
|
Some(config) => config,
|
|
|
|
Some(config) => config,
|
|
|
@ -711,8 +719,14 @@ impl Registry {
|
|
|
|
// initialize a new client
|
|
|
|
// initialize a new client
|
|
|
|
let id = self.counter.fetch_add(1, Ordering::Relaxed);
|
|
|
|
let id = self.counter.fetch_add(1, Ordering::Relaxed);
|
|
|
|
|
|
|
|
|
|
|
|
let NewClientResult(client, incoming) =
|
|
|
|
let NewClientResult(client, incoming) = start_client(
|
|
|
|
start_client(id, language_config, config, doc_path, root_dirs)?;
|
|
|
|
id,
|
|
|
|
|
|
|
|
language_config,
|
|
|
|
|
|
|
|
config,
|
|
|
|
|
|
|
|
doc_path,
|
|
|
|
|
|
|
|
root_dirs,
|
|
|
|
|
|
|
|
enable_snippets,
|
|
|
|
|
|
|
|
)?;
|
|
|
|
clients.push((id, client.clone()));
|
|
|
|
clients.push((id, client.clone()));
|
|
|
|
self.incoming.push(UnboundedReceiverStream::new(incoming));
|
|
|
|
self.incoming.push(UnboundedReceiverStream::new(incoming));
|
|
|
|
Ok(Some(client))
|
|
|
|
Ok(Some(client))
|
|
|
@ -811,6 +825,7 @@ fn start_client(
|
|
|
|
ls_config: &LanguageServerConfiguration,
|
|
|
|
ls_config: &LanguageServerConfiguration,
|
|
|
|
doc_path: Option<&std::path::PathBuf>,
|
|
|
|
doc_path: Option<&std::path::PathBuf>,
|
|
|
|
root_dirs: &[PathBuf],
|
|
|
|
root_dirs: &[PathBuf],
|
|
|
|
|
|
|
|
enable_snippets: bool,
|
|
|
|
) -> Result<NewClientResult> {
|
|
|
|
) -> Result<NewClientResult> {
|
|
|
|
let (client, incoming, initialize_notify) = Client::start(
|
|
|
|
let (client, incoming, initialize_notify) = Client::start(
|
|
|
|
&ls_config.command,
|
|
|
|
&ls_config.command,
|
|
|
@ -834,7 +849,7 @@ fn start_client(
|
|
|
|
.capabilities
|
|
|
|
.capabilities
|
|
|
|
.get_or_try_init(|| {
|
|
|
|
.get_or_try_init(|| {
|
|
|
|
_client
|
|
|
|
_client
|
|
|
|
.initialize()
|
|
|
|
.initialize(enable_snippets)
|
|
|
|
.map_ok(|response| response.capabilities)
|
|
|
|
.map_ok(|response| response.capabilities)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.await;
|
|
|
|
.await;
|
|
|
|