diff options
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 4 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/mod.rs | 12 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/subscriptions.rs | 6 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/project_model.rs | 6 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/req.rs | 4 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/server_world.rs | 8 |
8 files changed, 22 insertions, 20 deletions
diff --git a/crates/ra_lsp_server/Cargo.toml b/crates/ra_lsp_server/Cargo.toml index 32463e499..1fe6b2ebe 100644 --- a/crates/ra_lsp_server/Cargo.toml +++ b/crates/ra_lsp_server/Cargo.toml | |||
@@ -21,6 +21,7 @@ im = "12.0.0" | |||
21 | cargo_metadata = "0.6.0" | 21 | cargo_metadata = "0.6.0" |
22 | text_unit = { version = "0.1.2", features = ["serde"] } | 22 | text_unit = { version = "0.1.2", features = ["serde"] } |
23 | smol_str = { version = "0.1.5", features = ["serde"] } | 23 | smol_str = { version = "0.1.5", features = ["serde"] } |
24 | rustc-hash = "1.0" | ||
24 | 25 | ||
25 | ra_syntax = { path = "../ra_syntax" } | 26 | ra_syntax = { path = "../ra_syntax" } |
26 | ra_editor = { path = "../ra_editor" } | 27 | ra_editor = { path = "../ra_editor" } |
diff --git a/crates/ra_lsp_server/src/lib.rs b/crates/ra_lsp_server/src/lib.rs index d2f76972f..60652d55e 100644 --- a/crates/ra_lsp_server/src/lib.rs +++ b/crates/ra_lsp_server/src/lib.rs | |||
@@ -16,6 +16,7 @@ extern crate walkdir; | |||
16 | extern crate im; | 16 | extern crate im; |
17 | extern crate relative_path; | 17 | extern crate relative_path; |
18 | extern crate cargo_metadata; | 18 | extern crate cargo_metadata; |
19 | extern crate rustc_hash; | ||
19 | 20 | ||
20 | extern crate gen_lsp_server; | 21 | extern crate gen_lsp_server; |
21 | extern crate ra_editor; | 22 | extern crate ra_editor; |
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 725036cc7..ab8be15e9 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use std::collections::{HashMap}; | 1 | use rustc_hash::FxHashMap; |
2 | 2 | ||
3 | use languageserver_types::{ | 3 | use languageserver_types::{ |
4 | Diagnostic, DiagnosticSeverity, DocumentSymbol, | 4 | Diagnostic, DiagnosticSeverity, DocumentSymbol, |
@@ -267,7 +267,7 @@ pub fn handle_runnables( | |||
267 | bin: "cargo".to_string(), | 267 | bin: "cargo".to_string(), |
268 | args, | 268 | args, |
269 | env: { | 269 | env: { |
270 | let mut m = HashMap::new(); | 270 | let mut m = FxHashMap::default(); |
271 | m.insert( | 271 | m.insert( |
272 | "RUST_BACKTRACE".to_string(), | 272 | "RUST_BACKTRACE".to_string(), |
273 | "short".to_string(), | 273 | "short".to_string(), |
diff --git a/crates/ra_lsp_server/src/main_loop/mod.rs b/crates/ra_lsp_server/src/main_loop/mod.rs index 53c6f1dff..402615e42 100644 --- a/crates/ra_lsp_server/src/main_loop/mod.rs +++ b/crates/ra_lsp_server/src/main_loop/mod.rs | |||
@@ -3,7 +3,6 @@ mod subscriptions; | |||
3 | 3 | ||
4 | use std::{ | 4 | use std::{ |
5 | path::PathBuf, | 5 | path::PathBuf, |
6 | collections::{HashMap}, | ||
7 | }; | 6 | }; |
8 | 7 | ||
9 | use serde::{Serialize, de::DeserializeOwned}; | 8 | use serde::{Serialize, de::DeserializeOwned}; |
@@ -15,6 +14,7 @@ use gen_lsp_server::{ | |||
15 | RawRequest, RawNotification, RawMessage, RawResponse, ErrorCode, | 14 | RawRequest, RawNotification, RawMessage, RawResponse, ErrorCode, |
16 | handle_shutdown, | 15 | handle_shutdown, |
17 | }; | 16 | }; |
17 | use rustc_hash::FxHashMap; | ||
18 | 18 | ||
19 | use { | 19 | use { |
20 | req, | 20 | req, |
@@ -50,7 +50,7 @@ pub fn main_loop( | |||
50 | info!("server initialized, serving requests"); | 50 | info!("server initialized, serving requests"); |
51 | let mut state = ServerWorldState::new(); | 51 | let mut state = ServerWorldState::new(); |
52 | 52 | ||
53 | let mut pending_requests = HashMap::new(); | 53 | let mut pending_requests = FxHashMap::default(); |
54 | let mut subs = Subscriptions::new(); | 54 | let mut subs = Subscriptions::new(); |
55 | let main_res = main_loop_inner( | 55 | let main_res = main_loop_inner( |
56 | internal_mode, | 56 | internal_mode, |
@@ -95,7 +95,7 @@ fn main_loop_inner( | |||
95 | fs_worker: Worker<PathBuf, (PathBuf, Vec<FileEvent>)>, | 95 | fs_worker: Worker<PathBuf, (PathBuf, Vec<FileEvent>)>, |
96 | ws_worker: Worker<PathBuf, Result<CargoWorkspace>>, | 96 | ws_worker: Worker<PathBuf, Result<CargoWorkspace>>, |
97 | state: &mut ServerWorldState, | 97 | state: &mut ServerWorldState, |
98 | pending_requests: &mut HashMap<u64, JobHandle>, | 98 | pending_requests: &mut FxHashMap<u64, JobHandle>, |
99 | subs: &mut Subscriptions, | 99 | subs: &mut Subscriptions, |
100 | ) -> Result<()> { | 100 | ) -> Result<()> { |
101 | let (libdata_sender, libdata_receiver) = unbounded(); | 101 | let (libdata_sender, libdata_receiver) = unbounded(); |
@@ -213,7 +213,7 @@ fn main_loop_inner( | |||
213 | fn on_task( | 213 | fn on_task( |
214 | task: Task, | 214 | task: Task, |
215 | msg_sender: &Sender<RawMessage>, | 215 | msg_sender: &Sender<RawMessage>, |
216 | pending_requests: &mut HashMap<u64, JobHandle>, | 216 | pending_requests: &mut FxHashMap<u64, JobHandle>, |
217 | ) { | 217 | ) { |
218 | match task { | 218 | match task { |
219 | Task::Respond(response) => { | 219 | Task::Respond(response) => { |
@@ -229,7 +229,7 @@ fn on_task( | |||
229 | 229 | ||
230 | fn on_request( | 230 | fn on_request( |
231 | world: &mut ServerWorldState, | 231 | world: &mut ServerWorldState, |
232 | pending_requests: &mut HashMap<u64, JobHandle>, | 232 | pending_requests: &mut FxHashMap<u64, JobHandle>, |
233 | pool: &ThreadPool, | 233 | pool: &ThreadPool, |
234 | sender: &Sender<Task>, | 234 | sender: &Sender<Task>, |
235 | req: RawRequest, | 235 | req: RawRequest, |
@@ -269,7 +269,7 @@ fn on_request( | |||
269 | fn on_notification( | 269 | fn on_notification( |
270 | msg_sender: &Sender<RawMessage>, | 270 | msg_sender: &Sender<RawMessage>, |
271 | state: &mut ServerWorldState, | 271 | state: &mut ServerWorldState, |
272 | pending_requests: &mut HashMap<u64, JobHandle>, | 272 | pending_requests: &mut FxHashMap<u64, JobHandle>, |
273 | subs: &mut Subscriptions, | 273 | subs: &mut Subscriptions, |
274 | not: RawNotification, | 274 | not: RawNotification, |
275 | ) -> Result<()> { | 275 | ) -> Result<()> { |
diff --git a/crates/ra_lsp_server/src/main_loop/subscriptions.rs b/crates/ra_lsp_server/src/main_loop/subscriptions.rs index 27f92cc9a..310153382 100644 --- a/crates/ra_lsp_server/src/main_loop/subscriptions.rs +++ b/crates/ra_lsp_server/src/main_loop/subscriptions.rs | |||
@@ -1,13 +1,13 @@ | |||
1 | use std::collections::HashSet; | 1 | use rustc_hash::FxHashSet; |
2 | use ra_analysis::FileId; | 2 | use ra_analysis::FileId; |
3 | 3 | ||
4 | pub struct Subscriptions { | 4 | pub struct Subscriptions { |
5 | subs: HashSet<FileId>, | 5 | subs: FxHashSet<FileId>, |
6 | } | 6 | } |
7 | 7 | ||
8 | impl Subscriptions { | 8 | impl Subscriptions { |
9 | pub fn new() -> Subscriptions { | 9 | pub fn new() -> Subscriptions { |
10 | Subscriptions { subs: HashSet::new() } | 10 | Subscriptions { subs: FxHashSet::default() } |
11 | } | 11 | } |
12 | pub fn add_sub(&mut self, file_id: FileId) { | 12 | pub fn add_sub(&mut self, file_id: FileId) { |
13 | self.subs.insert(file_id); | 13 | self.subs.insert(file_id); |
diff --git a/crates/ra_lsp_server/src/project_model.rs b/crates/ra_lsp_server/src/project_model.rs index 5db34e3e5..43e4fd654 100644 --- a/crates/ra_lsp_server/src/project_model.rs +++ b/crates/ra_lsp_server/src/project_model.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use std::{ | 1 | use std::{ |
2 | collections::{HashMap, HashSet}, | ||
3 | path::{Path, PathBuf}, | 2 | path::{Path, PathBuf}, |
4 | }; | 3 | }; |
4 | use rustc_hash::{FxHashMap, FxHashSet}; | ||
5 | use cargo_metadata::{metadata_run, CargoOpt}; | 5 | use cargo_metadata::{metadata_run, CargoOpt}; |
6 | use ra_syntax::SmolStr; | 6 | use ra_syntax::SmolStr; |
7 | 7 | ||
@@ -80,11 +80,11 @@ impl CargoWorkspace { | |||
80 | true, | 80 | true, |
81 | Some(CargoOpt::AllFeatures) | 81 | Some(CargoOpt::AllFeatures) |
82 | ).map_err(|e| format_err!("cargo metadata failed: {}", e))?; | 82 | ).map_err(|e| format_err!("cargo metadata failed: {}", e))?; |
83 | let mut pkg_by_id = HashMap::new(); | 83 | let mut pkg_by_id = FxHashMap::default(); |
84 | let mut packages = Vec::new(); | 84 | let mut packages = Vec::new(); |
85 | let mut targets = Vec::new(); | 85 | let mut targets = Vec::new(); |
86 | 86 | ||
87 | let ws_members: HashSet<String> = meta.workspace_members | 87 | let ws_members: FxHashSet<String> = meta.workspace_members |
88 | .into_iter() | 88 | .into_iter() |
89 | .map(|it| it.raw) | 89 | .map(|it| it.raw) |
90 | .collect(); | 90 | .collect(); |
diff --git a/crates/ra_lsp_server/src/req.rs b/crates/ra_lsp_server/src/req.rs index 458c79ea9..f80957589 100644 --- a/crates/ra_lsp_server/src/req.rs +++ b/crates/ra_lsp_server/src/req.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use std::collections::HashMap; | 1 | use rustc_hash::FxHashMap; |
2 | use languageserver_types::{TextDocumentIdentifier, Range, Url, Position, Location}; | 2 | use languageserver_types::{TextDocumentIdentifier, Range, Url, Position, Location}; |
3 | use url_serde; | 3 | use url_serde; |
4 | 4 | ||
@@ -149,7 +149,7 @@ pub struct Runnable { | |||
149 | pub label: String, | 149 | pub label: String, |
150 | pub bin: String, | 150 | pub bin: String, |
151 | pub args: Vec<String>, | 151 | pub args: Vec<String>, |
152 | pub env: HashMap<String, String>, | 152 | pub env: FxHashMap<String, String>, |
153 | } | 153 | } |
154 | 154 | ||
155 | #[derive(Serialize, Debug)] | 155 | #[derive(Serialize, Debug)] |
diff --git a/crates/ra_lsp_server/src/server_world.rs b/crates/ra_lsp_server/src/server_world.rs index 865f7c491..c4cdf83d4 100644 --- a/crates/ra_lsp_server/src/server_world.rs +++ b/crates/ra_lsp_server/src/server_world.rs | |||
@@ -1,10 +1,10 @@ | |||
1 | use std::{ | 1 | use std::{ |
2 | fs, | 2 | fs, |
3 | path::{PathBuf, Path}, | 3 | path::{PathBuf, Path}, |
4 | collections::HashMap, | ||
5 | sync::Arc, | 4 | sync::Arc, |
6 | }; | 5 | }; |
7 | 6 | ||
7 | use rustc_hash::FxHashMap; | ||
8 | use languageserver_types::Url; | 8 | use languageserver_types::Url; |
9 | use ra_analysis::{FileId, AnalysisHost, Analysis, CrateGraph, CrateId, LibraryData, FileResolver}; | 9 | use ra_analysis::{FileId, AnalysisHost, Analysis, CrateGraph, CrateId, LibraryData, FileResolver}; |
10 | 10 | ||
@@ -20,7 +20,7 @@ pub struct ServerWorldState { | |||
20 | pub workspaces: Arc<Vec<CargoWorkspace>>, | 20 | pub workspaces: Arc<Vec<CargoWorkspace>>, |
21 | pub analysis_host: AnalysisHost, | 21 | pub analysis_host: AnalysisHost, |
22 | pub path_map: PathMap, | 22 | pub path_map: PathMap, |
23 | pub mem_map: HashMap<FileId, Option<String>>, | 23 | pub mem_map: FxHashMap<FileId, Option<String>>, |
24 | } | 24 | } |
25 | 25 | ||
26 | #[derive(Clone)] | 26 | #[derive(Clone)] |
@@ -36,7 +36,7 @@ impl ServerWorldState { | |||
36 | workspaces: Arc::new(Vec::new()), | 36 | workspaces: Arc::new(Vec::new()), |
37 | analysis_host: AnalysisHost::new(), | 37 | analysis_host: AnalysisHost::new(), |
38 | path_map: PathMap::new(), | 38 | path_map: PathMap::new(), |
39 | mem_map: HashMap::new(), | 39 | mem_map: FxHashMap::default(), |
40 | } | 40 | } |
41 | } | 41 | } |
42 | pub fn apply_fs_changes(&mut self, events: Vec<FileEvent>) { | 42 | pub fn apply_fs_changes(&mut self, events: Vec<FileEvent>) { |
@@ -121,7 +121,7 @@ impl ServerWorldState { | |||
121 | Ok(file_id) | 121 | Ok(file_id) |
122 | } | 122 | } |
123 | pub fn set_workspaces(&mut self, ws: Vec<CargoWorkspace>) { | 123 | pub fn set_workspaces(&mut self, ws: Vec<CargoWorkspace>) { |
124 | let mut crate_roots = HashMap::new(); | 124 | let mut crate_roots = FxHashMap::default(); |
125 | ws.iter() | 125 | ws.iter() |
126 | .flat_map(|ws| { | 126 | .flat_map(|ws| { |
127 | ws.packages() | 127 | ws.packages() |