From 69bbe79c5037eb3cd00744593d1836e45a6f56e1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 22 Aug 2019 14:44:16 +0300 Subject: implement feature flags --- crates/ra_lsp_server/src/world.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'crates/ra_lsp_server/src/world.rs') 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; use lsp_types::Url; use parking_lot::RwLock; use ra_ide_api::{ - Analysis, AnalysisChange, AnalysisHost, CrateGraph, FileId, LibraryData, SourceRootId, + Analysis, AnalysisChange, AnalysisHost, CrateGraph, FeatureFlags, FileId, LibraryData, + SourceRootId, }; use ra_vfs::{LineEndings, RootEntry, Vfs, VfsChange, VfsFile, VfsRoot}; use ra_vfs_glob::{Glob, RustPackageFilterBuilder}; @@ -22,7 +23,6 @@ use crate::{ #[derive(Debug, Clone)] pub struct Options { pub publish_decorations: bool, - pub show_workspace_loaded: bool, pub supports_location_link: bool, } @@ -58,6 +58,7 @@ impl WorldState { lru_capacity: Option, exclude_globs: &[Glob], options: Options, + feature_flags: FeatureFlags, ) -> WorldState { let mut change = AnalysisChange::new(); @@ -99,7 +100,7 @@ impl WorldState { } change.set_crate_graph(crate_graph); - let mut analysis_host = AnalysisHost::new(lru_capacity); + let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags); analysis_host.apply_change(change); WorldState { options, @@ -184,6 +185,10 @@ impl WorldState { pub fn complete_request(&mut self, request: CompletedRequest) { self.latest_requests.write().record(request) } + + pub fn feature_flags(&self) -> &FeatureFlags { + self.analysis_host.feature_flags() + } } impl WorldSnapshot { @@ -246,4 +251,8 @@ impl WorldSnapshot { let path = self.vfs.read().file2path(VfsFile(file_id.0)); self.workspaces.iter().find_map(|ws| ws.workspace_root_for(&path)) } + + pub fn feature_flags(&self) -> &FeatureFlags { + self.analysis.feature_flags() + } } -- cgit v1.2.3