Exclude symbols from BUILD.gn for completion
Some checks are pending
CI / lint (push) Waiting to run
CI / build (darwin-arm64) (push) Waiting to run
CI / build (linux-x64) (push) Waiting to run
CI / build (win32-x64) (push) Waiting to run
CI / attestation (push) Blocked by required conditions
CI / upload-release-artifacts (push) Blocked by required conditions
CI / publish-vscode (push) Blocked by required conditions
CI / publish-cargo (push) Blocked by required conditions

This commit is contained in:
Shuhei Takahashi 2025-12-17 23:46:50 +09:00
parent 095fa615d9
commit c454d1d27c
2 changed files with 12 additions and 3 deletions

View file

@ -68,6 +68,12 @@ pub fn is_good_for_scan(path: &Path) -> bool {
})
}
pub fn is_good_for_import(path: &Path) -> bool {
path.file_name()
.and_then(|name| name.to_str())
.is_some_and(|name| name.ends_with(".gni") || name == "BUILDCONFIG.gn")
}
pub fn find_gn_in_workspace_for_scan(workspace_root: &Path) -> impl Iterator<Item = PathBuf> {
walk_source_dirs(workspace_root).filter(|path| is_good_for_scan(path))
}

View file

@ -14,7 +14,10 @@
use std::sync::Arc;
use crate::analyzer::{AnalyzedFile, Analyzer, Template, Variable, WorkspaceAnalyzer};
use crate::{
analyzer::{AnalyzedFile, Analyzer, Template, Variable, WorkspaceAnalyzer},
common::utils::is_good_for_import,
};
pub struct SymbolSet {
files: Vec<Arc<AnalyzedFile>>,
@ -31,7 +34,7 @@ impl SymbolSet {
.scan_files()
.await
.into_iter()
.filter(|file| !file.external),
.filter(|file| !file.external && is_good_for_import(&file.document.path)),
);
}
@ -43,7 +46,7 @@ impl SymbolSet {
.scan_files()
.await
.into_iter()
.filter(|file| !file.external)
.filter(|file| !file.external && is_good_for_import(&file.document.path))
.collect();
Self { files }
}