From 34203256bf8f8ea12b233e0fb49b42bd8c423281 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 6 Aug 2019 13:00:37 +0200 Subject: introduce ra_vfs_glob crate It manages exclusion rules for the vfs crate --- crates/ra_project_model/Cargo.toml | 1 - crates/ra_project_model/src/lib.rs | 23 ----------------------- 2 files changed, 24 deletions(-) (limited to 'crates/ra_project_model') diff --git a/crates/ra_project_model/Cargo.toml b/crates/ra_project_model/Cargo.toml index 3545d23c9..4fd6c75ef 100644 --- a/crates/ra_project_model/Cargo.toml +++ b/crates/ra_project_model/Cargo.toml @@ -7,7 +7,6 @@ authors = ["rust-analyzer developers"] [dependencies] log = "0.4.5" rustc-hash = "1.0" -relative-path = "0.4.0" cargo_metadata = "0.8.0" 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::{ }; use ra_db::{CrateGraph, Edition, FileId}; -use relative_path::RelativePath; use rustc_hash::FxHashMap; use serde_json::from_reader; @@ -54,28 +53,6 @@ impl PackageRoot { pub fn is_member(&self) -> bool { self.is_member } - - pub fn include_dir(&self, dir_path: &RelativePath) -> bool { - const COMMON_IGNORED_DIRS: &[&str] = &["node_modules", "target", ".git"]; - const EXTERNAL_IGNORED_DIRS: &[&str] = &["examples", "tests", "benches"]; - - let is_ignored = if self.is_member { - dir_path.components().any(|c| COMMON_IGNORED_DIRS.contains(&c.as_str())) - } else { - dir_path.components().any(|c| { - let path = c.as_str(); - COMMON_IGNORED_DIRS.contains(&path) || EXTERNAL_IGNORED_DIRS.contains(&path) - }) - }; - - let hidden = dir_path.components().any(|c| c.as_str().starts_with('.')); - - !is_ignored && !hidden - } - - pub fn include_file(&self, file_path: &RelativePath) -> bool { - file_path.extension() == Some("rs") - } } impl ProjectWorkspace { -- cgit v1.2.3