implement feature flags
This commit is contained in:
@@ -14,6 +14,7 @@ mod db;
|
||||
pub mod mock_analysis;
|
||||
mod symbol_index;
|
||||
mod change;
|
||||
mod feature_flags;
|
||||
|
||||
mod status;
|
||||
mod completion;
|
||||
@@ -63,6 +64,7 @@ pub use crate::{
|
||||
completion::{CompletionItem, CompletionItemKind, InsertTextFormat},
|
||||
diagnostics::Severity,
|
||||
display::{file_structure, FunctionSignature, NavigationTarget, StructureNode},
|
||||
feature_flags::FeatureFlags,
|
||||
folding_ranges::{Fold, FoldKind},
|
||||
hover::HoverResult,
|
||||
inlay_hints::{InlayHint, InlayKind},
|
||||
@@ -247,13 +249,13 @@ pub struct AnalysisHost {
|
||||
|
||||
impl Default for AnalysisHost {
|
||||
fn default() -> AnalysisHost {
|
||||
AnalysisHost::new(None)
|
||||
AnalysisHost::new(None, FeatureFlags::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl AnalysisHost {
|
||||
pub fn new(lru_capcity: Option<usize>) -> AnalysisHost {
|
||||
AnalysisHost { db: db::RootDatabase::new(lru_capcity) }
|
||||
pub fn new(lru_capcity: Option<usize>, feature_flags: FeatureFlags) -> AnalysisHost {
|
||||
AnalysisHost { db: db::RootDatabase::new(lru_capcity, feature_flags) }
|
||||
}
|
||||
/// Returns a snapshot of the current state, which you can query for
|
||||
/// semantic information.
|
||||
@@ -261,6 +263,10 @@ impl AnalysisHost {
|
||||
Analysis { db: self.db.snapshot() }
|
||||
}
|
||||
|
||||
pub fn feature_flags(&self) -> &FeatureFlags {
|
||||
&self.db.feature_flags
|
||||
}
|
||||
|
||||
/// Applies changes to the current state of the world. If there are
|
||||
/// outstanding snapshots, they will be canceled.
|
||||
pub fn apply_change(&mut self, change: AnalysisChange) {
|
||||
@@ -319,6 +325,10 @@ impl Analysis {
|
||||
(host.analysis(), file_id)
|
||||
}
|
||||
|
||||
pub fn feature_flags(&self) -> &FeatureFlags {
|
||||
&self.db.feature_flags
|
||||
}
|
||||
|
||||
/// Debug info about the current state of the analysis
|
||||
pub fn status(&self) -> Cancelable<String> {
|
||||
self.with_db(|db| status::status(&*db))
|
||||
|
||||
Reference in New Issue
Block a user