aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_db')
-rw-r--r--crates/ide_db/src/helpers.rs20
1 files changed, 18 insertions, 2 deletions
diff --git a/crates/ide_db/src/helpers.rs b/crates/ide_db/src/helpers.rs
index d988588ff..e3e5670f1 100644
--- a/crates/ide_db/src/helpers.rs
+++ b/crates/ide_db/src/helpers.rs
@@ -1,9 +1,10 @@
1//! A module with ide helpers for high-level ide features. 1//! A module with ide helpers for high-level ide features.
2use crate::RootDatabase; 2pub mod insert_use;
3
3use hir::{Crate, Enum, Module, ScopeDef, Semantics, Trait}; 4use hir::{Crate, Enum, Module, ScopeDef, Semantics, Trait};
4use syntax::ast::{self, make}; 5use syntax::ast::{self, make};
5 6
6pub mod insert_use; 7use crate::RootDatabase;
7 8
8/// Converts the mod path struct into its ast representation. 9/// Converts the mod path struct into its ast representation.
9pub fn mod_path_to_ast(path: &hir::ModPath) -> ast::Path { 10pub fn mod_path_to_ast(path: &hir::ModPath) -> ast::Path {
@@ -201,3 +202,18 @@ pub use prelude::*;
201 Some(def) 202 Some(def)
202 } 203 }
203} 204}
205
206#[derive(Clone, Copy, Debug, PartialEq, Eq)]
207pub struct SnippetCap {
208 _private: (),
209}
210
211impl SnippetCap {
212 pub const fn new(allow_snippets: bool) -> Option<SnippetCap> {
213 if allow_snippets {
214 Some(SnippetCap { _private: () })
215 } else {
216 None
217 }
218 }
219}