diff options
author | Aleksey Kladov <[email protected]> | 2018-09-04 02:13:22 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-09-04 02:13:22 +0100 |
commit | 4df965a002b5296fc728f1bc2fb9312fe421ea5d (patch) | |
tree | 989dfb2bbc2751d97959b4ca320cc5301b2ec4f5 /crates/server/src/main_loop | |
parent | c3e28f06463854e4711c4c49a49c77d1e136969f (diff) |
work
Diffstat (limited to 'crates/server/src/main_loop')
-rw-r--r-- | crates/server/src/main_loop/mod.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/server/src/main_loop/mod.rs b/crates/server/src/main_loop/mod.rs index 58f6f88a7..52e3b661d 100644 --- a/crates/server/src/main_loop/mod.rs +++ b/crates/server/src/main_loop/mod.rs | |||
@@ -8,7 +8,7 @@ use std::{ | |||
8 | 8 | ||
9 | use threadpool::ThreadPool; | 9 | use threadpool::ThreadPool; |
10 | use serde::{Serialize, de::DeserializeOwned}; | 10 | use serde::{Serialize, de::DeserializeOwned}; |
11 | use crossbeam_channel::{bounded, Sender, Receiver}; | 11 | use crossbeam_channel::{unbounded, Sender, Receiver}; |
12 | use languageserver_types::{NumberOrString}; | 12 | use languageserver_types::{NumberOrString}; |
13 | use libanalysis::{FileId, JobHandle, JobToken, LibraryData}; | 13 | use libanalysis::{FileId, JobHandle, JobToken, LibraryData}; |
14 | use gen_lsp_server::{ | 14 | use gen_lsp_server::{ |
@@ -38,7 +38,7 @@ pub fn main_loop( | |||
38 | msg_sender: &mut Sender<RawMessage>, | 38 | msg_sender: &mut Sender<RawMessage>, |
39 | ) -> Result<()> { | 39 | ) -> Result<()> { |
40 | let pool = ThreadPool::new(4); | 40 | let pool = ThreadPool::new(4); |
41 | let (task_sender, task_receiver) = bounded::<Task>(16); | 41 | let (task_sender, task_receiver) = unbounded::<Task>(); |
42 | let (fs_sender, fs_receiver, fs_watcher) = vfs::roots_loader(); | 42 | let (fs_sender, fs_receiver, fs_watcher) = vfs::roots_loader(); |
43 | let (ws_sender, ws_receiver, ws_watcher) = workspace_loader(); | 43 | let (ws_sender, ws_receiver, ws_watcher) = workspace_loader(); |
44 | 44 | ||
@@ -97,7 +97,7 @@ fn main_loop_inner( | |||
97 | pending_requests: &mut HashMap<u64, JobHandle>, | 97 | pending_requests: &mut HashMap<u64, JobHandle>, |
98 | subs: &mut Subscriptions, | 98 | subs: &mut Subscriptions, |
99 | ) -> Result<()> { | 99 | ) -> Result<()> { |
100 | let (libdata_sender, libdata_receiver) = bounded(1024); | 100 | let (libdata_sender, libdata_receiver) = unbounded(); |
101 | ws_sender.send(ws_root.clone()); | 101 | ws_sender.send(ws_root.clone()); |
102 | fs_sender.send(ws_root.clone()); | 102 | fs_sender.send(ws_root.clone()); |
103 | loop { | 103 | loop { |
@@ -137,7 +137,10 @@ fn main_loop_inner( | |||
137 | let files = state.events_to_files(events); | 137 | let files = state.events_to_files(events); |
138 | let sender = libdata_sender.clone(); | 138 | let sender = libdata_sender.clone(); |
139 | pool.execute(move || { | 139 | pool.execute(move || { |
140 | let start = ::std::time::Instant::now(); | ||
141 | info!("indexing {} ... ", root.display()); | ||
140 | let data = LibraryData::prepare(files); | 142 | let data = LibraryData::prepare(files); |
143 | info!("indexed {:?} {}", start.elapsed(), root.display()); | ||
141 | sender.send(data); | 144 | sender.send(data); |
142 | }); | 145 | }); |
143 | } | 146 | } |