aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/world.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/world.rs')
-rw-r--r--crates/ra_lsp_server/src/world.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs
index 10f96812f..6696dff71 100644
--- a/crates/ra_lsp_server/src/world.rs
+++ b/crates/ra_lsp_server/src/world.rs
@@ -7,7 +7,8 @@ use gen_lsp_server::ErrorCode;
7use lsp_types::Url; 7use lsp_types::Url;
8use parking_lot::RwLock; 8use parking_lot::RwLock;
9use ra_ide_api::{ 9use ra_ide_api::{
10 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, SourceRootId, 10 Analysis, AnalysisChange, AnalysisHost, CrateGraph, FeatureFlags, FileId, LibraryData,
11 SourceRootId,
11}; 12};
12use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot}; 13use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot};
13use ra_vfs_glob::{Glob, RustPackageFilterBuilder}; 14use ra_vfs_glob::{Glob, RustPackageFilterBuilder};
@@ -22,7 +23,6 @@ use crate::{
22#[derive(Debug, Clone)] 23#[derive(Debug, Clone)]
23pub struct Options { 24pub struct Options {
24 pub publish_decorations: bool, 25 pub publish_decorations: bool,
25 pub show_workspace_loaded: bool,
26 pub supports_location_link: bool, 26 pub supports_location_link: bool,
27} 27}
28 28
@@ -58,6 +58,7 @@ impl WorldState {
58 lru_capacity: Option<usize>, 58 lru_capacity: Option<usize>,
59 exclude_globs: &[Glob], 59 exclude_globs: &[Glob],
60 options: Options, 60 options: Options,
61 feature_flags: FeatureFlags,
61 ) -> WorldState { 62 ) -> WorldState {
62 let mut change = AnalysisChange::new(); 63 let mut change = AnalysisChange::new();
63 64
@@ -99,7 +100,7 @@ impl WorldState {
99 } 100 }
100 change.set_crate_graph(crate_graph); 101 change.set_crate_graph(crate_graph);
101 102
102 let mut analysis_host = AnalysisHost::new(lru_capacity); 103 let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags);
103 analysis_host.apply_change(change); 104 analysis_host.apply_change(change);
104 WorldState { 105 WorldState {
105 options, 106 options,
@@ -184,6 +185,10 @@ impl WorldState {
184 pub fn complete_request(&mut self, request: CompletedRequest) { 185 pub fn complete_request(&mut self, request: CompletedRequest) {
185 self.latest_requests.write().record(request) 186 self.latest_requests.write().record(request)
186 } 187 }
188
189 pub fn feature_flags(&self) -> &FeatureFlags {
190 self.analysis_host.feature_flags()
191 }
187} 192}
188 193
189impl WorldSnapshot { 194impl WorldSnapshot {
@@ -246,4 +251,8 @@ impl WorldSnapshot {
246 let path = self.vfs.read().file2path(VfsFile(file_id.0)); 251 let path = self.vfs.read().file2path(VfsFile(file_id.0));
247 self.workspaces.iter().find_map(|ws| ws.workspace_root_for(&path)) 252 self.workspaces.iter().find_map(|ws| ws.workspace_root_for(&path))
248 } 253 }
254
255 pub fn feature_flags(&self) -> &FeatureFlags {
256 self.analysis.feature_flags()
257 }
249} 258}