diff options
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop.rs')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 8e830c8b8..b9c99a223 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -23,7 +23,7 @@ use crate::{ | |||
23 | project_model::workspace_loader, | 23 | project_model::workspace_loader, |
24 | req, | 24 | req, |
25 | world::{Options, WorldSnapshot, WorldState}, | 25 | world::{Options, WorldSnapshot, WorldState}, |
26 | InitializationOptions, Result, | 26 | Result, ServerConfig, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | const THREADPOOL_SIZE: usize = 8; | 29 | const THREADPOOL_SIZE: usize = 8; |
@@ -52,10 +52,11 @@ impl Error for LspError {} | |||
52 | pub fn main_loop( | 52 | pub fn main_loop( |
53 | ws_roots: Vec<PathBuf>, | 53 | ws_roots: Vec<PathBuf>, |
54 | client_caps: ClientCapabilities, | 54 | client_caps: ClientCapabilities, |
55 | options: InitializationOptions, | 55 | config: ServerConfig, |
56 | msg_receiver: &Receiver<RawMessage>, | 56 | msg_receiver: &Receiver<RawMessage>, |
57 | msg_sender: &Sender<RawMessage>, | 57 | msg_sender: &Sender<RawMessage>, |
58 | ) -> Result<()> { | 58 | ) -> Result<()> { |
59 | log::debug!("server_config: {:?}", config); | ||
59 | // FIXME: support dynamic workspace loading. | 60 | // FIXME: support dynamic workspace loading. |
60 | let workspaces = { | 61 | let workspaces = { |
61 | let ws_worker = workspace_loader(); | 62 | let ws_worker = workspace_loader(); |
@@ -77,14 +78,19 @@ pub fn main_loop( | |||
77 | } | 78 | } |
78 | loaded_workspaces | 79 | loaded_workspaces |
79 | }; | 80 | }; |
80 | 81 | let globs = config | |
82 | .exclude_globs | ||
83 | .iter() | ||
84 | .map(|glob| ra_vfs_glob::Glob::new(glob)) | ||
85 | .collect::<std::result::Result<Vec<_>, _>>()?; | ||
81 | let mut state = WorldState::new( | 86 | let mut state = WorldState::new( |
82 | ws_roots, | 87 | ws_roots, |
83 | workspaces, | 88 | workspaces, |
84 | options.lru_capacity, | 89 | config.lru_capacity, |
90 | &globs, | ||
85 | Options { | 91 | Options { |
86 | publish_decorations: options.publish_decorations, | 92 | publish_decorations: config.publish_decorations, |
87 | show_workspace_loaded: options.show_workspace_loaded, | 93 | show_workspace_loaded: config.show_workspace_loaded, |
88 | supports_location_link: client_caps | 94 | supports_location_link: client_caps |
89 | .text_document | 95 | .text_document |
90 | .and_then(|it| it.definition) | 96 | .and_then(|it| it.definition) |
@@ -269,7 +275,7 @@ fn main_loop_inner( | |||
269 | && pending_libraries.is_empty() | 275 | && pending_libraries.is_empty() |
270 | && in_flight_libraries == 0 | 276 | && in_flight_libraries == 0 |
271 | { | 277 | { |
272 | let n_packages: usize = state.workspaces.iter().map(|it| it.count()).sum(); | 278 | let n_packages: usize = state.workspaces.iter().map(|it| it.n_packages()).sum(); |
273 | if state.options.show_workspace_loaded { | 279 | if state.options.show_workspace_loaded { |
274 | let msg = format!("workspace loaded, {} rust packages", n_packages); | 280 | let msg = format!("workspace loaded, {} rust packages", n_packages); |
275 | show_message(req::MessageType::Info, msg, msg_sender); | 281 | show_message(req::MessageType::Info, msg, msg_sender); |
@@ -340,7 +346,6 @@ fn on_request( | |||
340 | })? | 346 | })? |
341 | .on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)? | 347 | .on::<req::AnalyzerStatus>(handlers::handle_analyzer_status)? |
342 | .on::<req::SyntaxTree>(handlers::handle_syntax_tree)? | 348 | .on::<req::SyntaxTree>(handlers::handle_syntax_tree)? |
343 | .on::<req::ExtendSelection>(handlers::handle_extend_selection)? | ||
344 | .on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)? | 349 | .on::<req::OnTypeFormatting>(handlers::handle_on_type_formatting)? |
345 | .on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)? | 350 | .on::<req::DocumentSymbolRequest>(handlers::handle_document_symbol)? |
346 | .on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)? | 351 | .on::<req::WorkspaceSymbol>(handlers::handle_workspace_symbol)? |