summaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-12-23 06:50:16 +0000
committerBlaž Hrastnik2020-12-23 06:50:16 +0000
commit955cb81687db139422875d02b534d753dac5603f (patch)
tree68fe4df7283de4809a4afce8c7f2dcf4232f110a /helix-term/src
parentc8424c6ff0bb35c7eb422578e899158e3549f85f (diff)
Init lsp through the registry.
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index b90ec283..e15f21c6 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -10,6 +10,7 @@ use log::{debug, info};
use std::{
io::{self, stdout, Stdout, Write},
path::PathBuf,
+ sync::Arc,
time::Duration,
};
@@ -32,7 +33,8 @@ pub struct Application {
terminal: Terminal,
executor: &'static smol::Executor<'static>,
- language_server: helix_lsp::Client,
+ language_server: Arc<helix_lsp::Client>,
+ language_servers: helix_lsp::Registry,
}
impl Application {
@@ -49,7 +51,8 @@ impl Application {
let mut compositor = Compositor::new();
compositor.push(Box::new(ui::EditorView::new()));
- let language_server = helix_lsp::Client::start(&executor, "rust-analyzer", &[]);
+ let language_servers = helix_lsp::Registry::new();
+ let language_server = language_servers.get("rust", &executor).unwrap();
let mut app = Self {
editor,
@@ -58,6 +61,7 @@ impl Application {
executor,
language_server,
+ language_servers,
};
Ok(app)
@@ -81,9 +85,6 @@ impl Application {
pub async fn event_loop(&mut self) {
let mut reader = EventStream::new();
- // initialize lsp
- self.language_server.initialize().await.unwrap();
-
self.language_server
.text_document_did_open(&self.editor.view().unwrap().doc)
.await
@@ -101,7 +102,7 @@ impl Application {
event = reader.next().fuse() => {
self.handle_terminal_events(event)
}
- call = self.language_server.incoming.next().fuse() => {
+ call = self.language_servers.incoming.next().fuse() => {
self.handle_language_server_message(call).await
}
}