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 | |
parent | c3e28f06463854e4711c4c49a49c77d1e136969f (diff) |
work
Diffstat (limited to 'crates/server/src')
-rw-r--r-- | crates/server/src/main_loop/mod.rs | 9 | ||||
-rw-r--r-- | crates/server/src/vfs.rs | 6 |
2 files changed, 9 insertions, 6 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 | } |
diff --git a/crates/server/src/vfs.rs b/crates/server/src/vfs.rs index 69a7654af..2699fc21e 100644 --- a/crates/server/src/vfs.rs +++ b/crates/server/src/vfs.rs | |||
@@ -3,7 +3,7 @@ use std::{ | |||
3 | fs, | 3 | fs, |
4 | }; | 4 | }; |
5 | 5 | ||
6 | use crossbeam_channel::{Sender, Receiver, bounded}; | 6 | use crossbeam_channel::{Sender, Receiver, unbounded}; |
7 | use walkdir::WalkDir; | 7 | use walkdir::WalkDir; |
8 | 8 | ||
9 | use { | 9 | use { |
@@ -23,8 +23,8 @@ pub enum FileEventKind { | |||
23 | } | 23 | } |
24 | 24 | ||
25 | pub fn roots_loader() -> (Sender<PathBuf>, Receiver<(PathBuf, Vec<FileEvent>)>, ThreadWatcher) { | 25 | pub fn roots_loader() -> (Sender<PathBuf>, Receiver<(PathBuf, Vec<FileEvent>)>, ThreadWatcher) { |
26 | let (path_sender, path_receiver) = bounded::<PathBuf>(2048); | 26 | let (path_sender, path_receiver) = unbounded::<PathBuf>(); |
27 | let (event_sender, event_receiver) = bounded::<(PathBuf, Vec<FileEvent>)>(1); | 27 | let (event_sender, event_receiver) = unbounded::<(PathBuf, Vec<FileEvent>)>(); |
28 | let thread = ThreadWatcher::spawn("roots loader", move || { | 28 | let thread = ThreadWatcher::spawn("roots loader", move || { |
29 | path_receiver | 29 | path_receiver |
30 | .into_iter() | 30 | .into_iter() |