feat: improve error message for files with an unknown grammar path

This commit is contained in:
Amaan Qureshi 2024-02-12 16:13:22 -05:00
parent 48deb309db
commit 21f25a5305
7 changed files with 89 additions and 19 deletions

View file

@ -575,6 +575,7 @@ fn run() -> Result<()> {
highlighter.parser = parser;
test_highlight::test_highlights(
&loader,
&config.get()?,
&mut highlighter,
&test_highlight_dir,
test_options.apply_all_captures,
@ -586,7 +587,7 @@ fn run() -> Result<()> {
if test_tag_dir.is_dir() {
let mut tags_context = TagsContext::new();
tags_context.parser = parser;
test_tags::test_tags(&loader, &mut tags_context, &test_tag_dir)?;
test_tags::test_tags(&loader, &config.get()?, &mut tags_context, &test_tag_dir)?;
}
}
@ -662,7 +663,7 @@ fn run() -> Result<()> {
if let Some(v) = loader.language_configuration_for_file_name(path)? {
v
} else {
eprintln!("No language found for path {path:?}");
eprintln!("{}", util::lang_not_found_for_path(path, &loader_config));
continue;
}
}
@ -744,6 +745,7 @@ fn run() -> Result<()> {
let paths = collect_paths(tags_options.paths_file.as_deref(), tags_options.paths)?;
tags::generate_tags(
&loader,
&config.get()?,
tags_options.scope.as_deref(),
&paths,
tags_options.quiet,