aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/config.rs6
-rw-r--r--crates/rust-analyzer/src/main_loop.rs17
-rw-r--r--crates/rust-analyzer/src/req.rs4
3 files changed, 16 insertions, 11 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index b19421c16..15aab7f09 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -38,12 +38,12 @@ pub struct Config {
38 38
39#[derive(Debug, Clone)] 39#[derive(Debug, Clone)]
40pub struct FilesConfig { 40pub struct FilesConfig {
41 watcher: FilesWatcher, 41 pub watcher: FilesWatcher,
42 exclude: Vec<String>, 42 pub exclude: Vec<String>,
43} 43}
44 44
45#[derive(Debug, Clone)] 45#[derive(Debug, Clone)]
46enum FilesWatcher { 46pub enum FilesWatcher {
47 Client, 47 Client,
48 Notify, 48 Notify,
49} 49}
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 47fef59d4..36ea85cc6 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -30,7 +30,7 @@ use serde::{de::DeserializeOwned, Serialize};
30use threadpool::ThreadPool; 30use threadpool::ThreadPool;
31 31
32use crate::{ 32use crate::{
33 config::Config, 33 config::{Config, FilesWatcher},
34 diagnostics::DiagnosticTask, 34 diagnostics::DiagnosticTask,
35 main_loop::{ 35 main_loop::{
36 pending_requests::{PendingRequest, PendingRequests}, 36 pending_requests::{PendingRequest, PendingRequests},
@@ -40,7 +40,6 @@ use crate::{
40 world::{WorldSnapshot, WorldState}, 40 world::{WorldSnapshot, WorldState},
41 Result, 41 Result,
42}; 42};
43use req::ConfigurationParams;
44 43
45#[derive(Debug)] 44#[derive(Debug)]
46pub struct LspError { 45pub struct LspError {
@@ -122,12 +121,13 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection)
122 }; 121 };
123 122
124 let globs = config 123 let globs = config
125 .exclude_globs 124 .files
125 .exclude
126 .iter() 126 .iter()
127 .map(|glob| crate::vfs_glob::Glob::new(glob)) 127 .map(|glob| crate::vfs_glob::Glob::new(glob))
128 .collect::<std::result::Result<Vec<_>, _>>()?; 128 .collect::<std::result::Result<Vec<_>, _>>()?;
129 129
130 if config.use_client_watching { 130 if let FilesWatcher::Client = config.files.watcher {
131 let registration_options = req::DidChangeWatchedFilesRegistrationOptions { 131 let registration_options = req::DidChangeWatchedFilesRegistrationOptions {
132 watchers: workspaces 132 watchers: workspaces
133 .iter() 133 .iter()
@@ -153,7 +153,7 @@ pub fn main_loop(ws_roots: Vec<PathBuf>, config: Config, connection: Connection)
153 workspaces, 153 workspaces,
154 config.lru_capacity, 154 config.lru_capacity,
155 &globs, 155 &globs,
156 Watch(!config.use_client_watching), 156 Watch(matches!(config.files.watcher, FilesWatcher::Notify)),
157 config, 157 config,
158 ) 158 )
159 }; 159 };
@@ -607,7 +607,12 @@ fn on_notification(
607 let request_id = loop_state.next_request_id(); 607 let request_id = loop_state.next_request_id();
608 let request = request_new::<req::WorkspaceConfiguration>( 608 let request = request_new::<req::WorkspaceConfiguration>(
609 request_id.clone(), 609 request_id.clone(),
610 ConfigurationParams::default(), 610 req::ConfigurationParams {
611 items: vec![req::ConfigurationItem {
612 scope_uri: None,
613 section: Some("rust-analyzer".to_string()),
614 }],
615 },
611 ); 616 );
612 msg_sender.send(request.into())?; 617 msg_sender.send(request.into())?;
613 loop_state.configuration_request_id = Some(request_id); 618 loop_state.configuration_request_id = Some(request_id);
diff --git a/crates/rust-analyzer/src/req.rs b/crates/rust-analyzer/src/req.rs
index ce799a683..b8b627e28 100644
--- a/crates/rust-analyzer/src/req.rs
+++ b/crates/rust-analyzer/src/req.rs
@@ -6,8 +6,8 @@ use serde::{Deserialize, Serialize};
6 6
7pub use lsp_types::{ 7pub use lsp_types::{
8 notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens, 8 notification::*, request::*, ApplyWorkspaceEditParams, CodeActionParams, CodeLens,
9 CodeLensParams, CompletionParams, CompletionResponse, ConfigurationParams, DiagnosticTag, 9 CodeLensParams, CompletionParams, CompletionResponse, ConfigurationItem, ConfigurationParams,
10 DidChangeConfigurationParams, DidChangeWatchedFilesParams, 10 DiagnosticTag, DidChangeConfigurationParams, DidChangeWatchedFilesParams,
11 DidChangeWatchedFilesRegistrationOptions, DocumentOnTypeFormattingParams, DocumentSymbolParams, 11 DidChangeWatchedFilesRegistrationOptions, DocumentOnTypeFormattingParams, DocumentSymbolParams,
12 DocumentSymbolResponse, FileSystemWatcher, Hover, InitializeResult, MessageType, 12 DocumentSymbolResponse, FileSystemWatcher, Hover, InitializeResult, MessageType,
13 PartialResultParams, ProgressParams, ProgressParamsValue, ProgressToken, 13 PartialResultParams, ProgressParams, ProgressParamsValue, ProgressToken,