diff --git a/cli/loader/Cargo.toml b/cli/loader/Cargo.toml index 57e34ec4..f8525afc 100644 --- a/cli/loader/Cargo.toml +++ b/cli/loader/Cargo.toml @@ -19,6 +19,7 @@ anyhow.workspace = true cc.workspace = true dirs.workspace = true fs4.workspace = true +indoc.workspace = true libloading.workspace = true once_cell.workspace = true regex.workspace = true diff --git a/cli/loader/src/lib.rs b/cli/loader/src/lib.rs index d534c15a..f5dffa02 100644 --- a/cli/loader/src/lib.rs +++ b/cli/loader/src/lib.rs @@ -1,11 +1,5 @@ #![doc = include_str!("../README.md")] -use anyhow::{anyhow, Context, Error, Result}; -use fs4::FileExt; -use libloading::{Library, Symbol}; -use once_cell::unsync::OnceCell; -use regex::{Regex, RegexBuilder}; -use serde::{Deserialize, Deserializer, Serialize}; use std::collections::HashMap; use std::ffi::{OsStr, OsString}; use std::io::BufReader; @@ -15,6 +9,14 @@ use std::process::Command; use std::sync::Mutex; use std::time::SystemTime; use std::{env, fs, mem}; + +use anyhow::{anyhow, Context, Error, Result}; +use fs4::FileExt; +use indoc::indoc; +use libloading::{Library, Symbol}; +use once_cell::unsync::OnceCell; +use regex::{Regex, RegexBuilder}; +use serde::{Deserialize, Deserializer, Serialize}; use tree_sitter::{Language, QueryError, QueryErrorKind}; use tree_sitter_highlight::HighlightConfiguration; use tree_sitter_tags::{Error as TagsError, TagsConfiguration}; @@ -1192,6 +1194,16 @@ impl<'a> LanguageConfiguration<'a> { path_ranges.push((path.clone(), prev_query_len..query.len())); } } else { + // highlights.scm is needed to test highlights, and tags.scm to test tags + if default_path == "highlights.scm" || default_path == "tags.scm" { + eprintln!( + indoc! {" + Warning: you should add a `{}` entry pointing to the highlights path in `tree-sitter` language list in the grammar's package.json + See more here: https://tree-sitter.github.io/tree-sitter/syntax-highlighting#query-paths + "}, + default_path.replace(".scm", "") + ); + } let queries_path = self.root_path.join("queries"); let path = queries_path.join(default_path); if path.exists() {