diff options
Diffstat (limited to 'crates/server')
-rw-r--r-- | crates/server/src/main_loop/mod.rs | 9 | ||||
-rw-r--r-- | crates/server/src/vfs.rs | 6 | ||||
-rw-r--r-- | crates/server/tests/heavy_tests/main.rs | 2 |
3 files changed, 10 insertions, 7 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() |
diff --git a/crates/server/tests/heavy_tests/main.rs b/crates/server/tests/heavy_tests/main.rs index 66620ac62..50529f453 100644 --- a/crates/server/tests/heavy_tests/main.rs +++ b/crates/server/tests/heavy_tests/main.rs | |||
@@ -95,5 +95,5 @@ fn test_eggs() {} | |||
95 | // extern crate regex; | 95 | // extern crate regex; |
96 | // "#); | 96 | // "#); |
97 | // server.wait_for_feedback("workspace loaded"); | 97 | // server.wait_for_feedback("workspace loaded"); |
98 | // server.wait_for_feedback_n("library loaded", 1); | 98 | // server.wait_for_feedback_n("library loaded", 9); |
99 | // } | 99 | // } |