aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/conv.rs4
-rw-r--r--crates/ra_lsp_server/src/main.rs2
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs8
-rw-r--r--crates/ra_lsp_server/src/main_loop/mod.rs4
-rw-r--r--crates/ra_lsp_server/src/project_model.rs1
-rw-r--r--crates/ra_lsp_server/src/server_world.rs4
-rw-r--r--crates/ra_lsp_server/src/thread_watcher.rs10
-rw-r--r--crates/ra_lsp_server/src/vfs.rs1
8 files changed, 16 insertions, 18 deletions
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index 8325e8c1e..bc0cf7c68 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -65,7 +65,7 @@ impl ConvWith for TextUnit {
65 fn conv_with(self, line_index: &LineIndex) -> Position { 65 fn conv_with(self, line_index: &LineIndex) -> Position {
66 let line_col = line_index.line_col(self); 66 let line_col = line_index.line_col(self);
67 // TODO: UTF-16 67 // TODO: UTF-16
68 Position::new(line_col.line as u64, u32::from(line_col.col) as u64) 68 Position::new(u64::from(line_col.line), u64::from(u32::from(line_col.col)))
69 } 69 }
70} 70}
71 71
@@ -192,7 +192,7 @@ impl TryConvWith for SourceChange {
192 .map(|it| it.edits.as_slice()) 192 .map(|it| it.edits.as_slice())
193 .unwrap_or(&[]); 193 .unwrap_or(&[]);
194 let line_col = translate_offset_with_edit(&*line_index, pos.offset, edits); 194 let line_col = translate_offset_with_edit(&*line_index, pos.offset, edits);
195 let position = Position::new(line_col.line as u64, u32::from(line_col.col) as u64); 195 let position = Position::new(u64::from(line_col.line), u64::from(u32::from(line_col.col)));
196 Some(TextDocumentPositionParams { 196 Some(TextDocumentPositionParams {
197 text_document: TextDocumentIdentifier::new(pos.file_id.try_conv_with(world)?), 197 text_document: TextDocumentIdentifier::new(pos.file_id.try_conv_with(world)?),
198 position, 198 position,
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index 9f62347f1..c07eb0140 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -18,7 +18,7 @@ fn main() -> Result<()> {
18 .directory("log") 18 .directory("log")
19 .start()?; 19 .start()?;
20 info!("lifecycle: server started"); 20 info!("lifecycle: server started");
21 match ::std::panic::catch_unwind(|| main_inner()) { 21 match ::std::panic::catch_unwind(main_inner) {
22 Ok(res) => { 22 Ok(res) => {
23 info!("lifecycle: terminating process with {:?}", res); 23 info!("lifecycle: terminating process with {:?}", res);
24 res 24 res
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index f5dff4c80..11f34eb93 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -154,8 +154,8 @@ pub fn handle_workspace_symbol(
154 world: ServerWorld, 154 world: ServerWorld,
155 params: req::WorkspaceSymbolParams, 155 params: req::WorkspaceSymbolParams,
156) -> Result<Option<Vec<SymbolInformation>>> { 156) -> Result<Option<Vec<SymbolInformation>>> {
157 let all_symbols = params.query.contains("#"); 157 let all_symbols = params.query.contains('#');
158 let libs = params.query.contains("*"); 158 let libs = params.query.contains('*');
159 let query = { 159 let query = {
160 let query: String = params 160 let query: String = params
161 .query 161 .query
@@ -279,8 +279,8 @@ pub fn handle_runnables(
279 .filter_map(|ws| { 279 .filter_map(|ws| {
280 let tgt = ws.target_by_root(path)?; 280 let tgt = ws.target_by_root(path)?;
281 Some(( 281 Some((
282 tgt.package(ws).name(ws).clone(), 282 tgt.package(ws).name(ws),
283 tgt.name(ws).clone(), 283 tgt.name(ws),
284 tgt.kind(ws), 284 tgt.kind(ws),
285 )) 285 ))
286 }) 286 })
diff --git a/crates/ra_lsp_server/src/main_loop/mod.rs b/crates/ra_lsp_server/src/main_loop/mod.rs
index b35ebd38b..69dcc7e57 100644
--- a/crates/ra_lsp_server/src/main_loop/mod.rs
+++ b/crates/ra_lsp_server/src/main_loop/mod.rs
@@ -32,7 +32,7 @@ enum Task {
32pub fn main_loop( 32pub fn main_loop(
33 internal_mode: bool, 33 internal_mode: bool,
34 root: PathBuf, 34 root: PathBuf,
35 msg_receriver: &Receiver<RawMessage>, 35 msg_receiver: &Receiver<RawMessage>,
36 msg_sender: &Sender<RawMessage>, 36 msg_sender: &Sender<RawMessage>,
37) -> Result<()> { 37) -> Result<()> {
38 let pool = rayon::ThreadPoolBuilder::new() 38 let pool = rayon::ThreadPoolBuilder::new()
@@ -54,7 +54,7 @@ pub fn main_loop(
54 root, 54 root,
55 &pool, 55 &pool,
56 msg_sender, 56 msg_sender,
57 msg_receriver, 57 msg_receiver,
58 task_sender, 58 task_sender,
59 task_receiver.clone(), 59 task_receiver.clone(),
60 fs_worker, 60 fs_worker,
diff --git a/crates/ra_lsp_server/src/project_model.rs b/crates/ra_lsp_server/src/project_model.rs
index 04e2ef9c8..cabb336a3 100644
--- a/crates/ra_lsp_server/src/project_model.rs
+++ b/crates/ra_lsp_server/src/project_model.rs
@@ -173,7 +173,6 @@ pub fn workspace_loader() -> (Worker<PathBuf, Result<CargoWorkspace>>, ThreadWat
173 1, 173 1,
174 |input_receiver, output_sender| { 174 |input_receiver, output_sender| {
175 input_receiver 175 input_receiver
176 .into_iter()
177 .map(|path| CargoWorkspace::from_cargo_metadata(path.as_path())) 176 .map(|path| CargoWorkspace::from_cargo_metadata(path.as_path()))
178 .for_each(|it| output_sender.send(it)) 177 .for_each(|it| output_sender.send(it))
179 }, 178 },
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs
index 35ff65ea1..69b2a1cd1 100644
--- a/crates/ra_lsp_server/src/server_world.rs
+++ b/crates/ra_lsp_server/src/server_world.rs
@@ -73,9 +73,7 @@ impl ServerWorldState {
73 events 73 events
74 .into_iter() 74 .into_iter()
75 .map(|event| { 75 .map(|event| {
76 let text = match event.kind { 76 let FileEventKind::Add(text) = event.kind;
77 FileEventKind::Add(text) => text,
78 };
79 (event.path, text) 77 (event.path, text)
80 }) 78 })
81 .map(|(path, text)| (pm.get_or_insert(path, Root::Lib), text)) 79 .map(|(path, text)| (pm.get_or_insert(path, Root::Lib), text))
diff --git a/crates/ra_lsp_server/src/thread_watcher.rs b/crates/ra_lsp_server/src/thread_watcher.rs
index 51b35fa66..5143c77ae 100644
--- a/crates/ra_lsp_server/src/thread_watcher.rs
+++ b/crates/ra_lsp_server/src/thread_watcher.rs
@@ -17,8 +17,7 @@ impl<I, O> Worker<I, O> {
17 I: Send + 'static, 17 I: Send + 'static,
18 O: Send + 'static, 18 O: Send + 'static,
19 { 19 {
20 let ((inp, out), inp_r, out_s) = worker_chan(buf); 20 let (worker, inp_r, out_s) = worker_chan(buf);
21 let worker = Worker { inp, out };
22 let watcher = ThreadWatcher::spawn(name, move || f(inp_r, out_s)); 21 let watcher = ThreadWatcher::spawn(name, move || f(inp_r, out_s));
23 (worker, watcher) 22 (worker, watcher)
24 } 23 }
@@ -67,11 +66,14 @@ impl ThreadWatcher {
67/// Sets up worker channels in a deadlock-avoind way. 66/// Sets up worker channels in a deadlock-avoind way.
68/// If one sets both input and output buffers to a fixed size, 67/// If one sets both input and output buffers to a fixed size,
69/// a worker might get stuck. 68/// a worker might get stuck.
70fn worker_chan<I, O>(buf: usize) -> ((Sender<I>, Receiver<O>), Receiver<I>, Sender<O>) { 69fn worker_chan<I, O>(buf: usize) -> (Worker<I, O>, Receiver<I>, Sender<O>) {
71 let (input_sender, input_receiver) = bounded::<I>(buf); 70 let (input_sender, input_receiver) = bounded::<I>(buf);
72 let (output_sender, output_receiver) = unbounded::<O>(); 71 let (output_sender, output_receiver) = unbounded::<O>();
73 ( 72 (
74 (input_sender, output_receiver), 73 Worker {
74 inp: input_sender,
75 out: output_receiver,
76 },
75 input_receiver, 77 input_receiver,
76 output_sender, 78 output_sender,
77 ) 79 )
diff --git a/crates/ra_lsp_server/src/vfs.rs b/crates/ra_lsp_server/src/vfs.rs
index 417a3c19a..6e317d854 100644
--- a/crates/ra_lsp_server/src/vfs.rs
+++ b/crates/ra_lsp_server/src/vfs.rs
@@ -24,7 +24,6 @@ pub fn roots_loader() -> (Worker<PathBuf, (PathBuf, Vec<FileEvent>)>, ThreadWatc
24 128, 24 128,
25 |input_receiver, output_sender| { 25 |input_receiver, output_sender| {
26 input_receiver 26 input_receiver
27 .into_iter()
28 .map(|path| { 27 .map(|path| {
29 debug!("loading {} ...", path.as_path().display()); 28 debug!("loading {} ...", path.as_path().display());
30 let events = load_root(path.as_path()); 29 let events = load_root(path.as_path());