diff options
Diffstat (limited to 'crates/ra_project_model/src')
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index c7167046b..55b94b911 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -10,7 +10,6 @@ use std::{ | |||
10 | }; | 10 | }; |
11 | 11 | ||
12 | use ra_db::{CrateGraph, Edition, FileId}; | 12 | use ra_db::{CrateGraph, Edition, FileId}; |
13 | use relative_path::RelativePath; | ||
14 | use rustc_hash::FxHashMap; | 13 | use rustc_hash::FxHashMap; |
15 | use serde_json::from_reader; | 14 | use serde_json::from_reader; |
16 | 15 | ||
@@ -54,28 +53,6 @@ impl PackageRoot { | |||
54 | pub fn is_member(&self) -> bool { | 53 | pub fn is_member(&self) -> bool { |
55 | self.is_member | 54 | self.is_member |
56 | } | 55 | } |
57 | |||
58 | pub fn include_dir(&self, dir_path: &RelativePath) -> bool { | ||
59 | const COMMON_IGNORED_DIRS: &[&str] = &["node_modules", "target", ".git"]; | ||
60 | const EXTERNAL_IGNORED_DIRS: &[&str] = &["examples", "tests", "benches"]; | ||
61 | |||
62 | let is_ignored = if self.is_member { | ||
63 | dir_path.components().any(|c| COMMON_IGNORED_DIRS.contains(&c.as_str())) | ||
64 | } else { | ||
65 | dir_path.components().any(|c| { | ||
66 | let path = c.as_str(); | ||
67 | COMMON_IGNORED_DIRS.contains(&path) || EXTERNAL_IGNORED_DIRS.contains(&path) | ||
68 | }) | ||
69 | }; | ||
70 | |||
71 | let hidden = dir_path.components().any(|c| c.as_str().starts_with('.')); | ||
72 | |||
73 | !is_ignored && !hidden | ||
74 | } | ||
75 | |||
76 | pub fn include_file(&self, file_path: &RelativePath) -> bool { | ||
77 | file_path.extension() == Some("rs") | ||
78 | } | ||
79 | } | 56 | } |
80 | 57 | ||
81 | impl ProjectWorkspace { | 58 | impl ProjectWorkspace { |