Skip to content

Commit 5a06fff

Browse files
author
Christian Speich
committed
syntax: Don't force lower-case for filenames (#4346)
Just like for grammars we currently force a lower-case of the name for some actions (like filesystem lookup). To make this consistent and less surprising for users, we remove this lower-casing here. Note: it is still the preferred way to name both language and grammar in lower-case Signed-off-by: Christian Speich <[email protected]>
1 parent f77d360 commit 5a06fff

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

helix-core/src/syntax.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,12 @@ pub fn read_query(language: &str, filename: &str) -> String {
355355

356356
impl LanguageConfiguration {
357357
fn initialize_highlight(&self, scopes: &[String]) -> Option<Arc<HighlightConfiguration>> {
358-
let language = self.language_id.to_ascii_lowercase();
359-
360-
let highlights_query = read_query(&language, "highlights.scm");
358+
let highlights_query = read_query(&self.language_id, "highlights.scm");
361359
// always highlight syntax errors
362360
// highlights_query += "\n(ERROR) @error";
363361

364-
let injections_query = read_query(&language, "injections.scm");
365-
let locals_query = read_query(&language, "locals.scm");
362+
let injections_query = read_query(&self.language_id, "injections.scm");
363+
let locals_query = read_query(&self.language_id, "locals.scm");
366364

367365
if highlights_query.is_empty() {
368366
None
@@ -426,14 +424,20 @@ impl LanguageConfiguration {
426424
}
427425

428426
fn load_query(&self, kind: &str) -> Option<Query> {
429-
let lang_name = self.language_id.to_ascii_lowercase();
430-
let query_text = read_query(&lang_name, kind);
427+
let query_text = read_query(&self.language_id, kind);
431428
if query_text.is_empty() {
432429
return None;
433430
}
434431
let lang = self.highlight_config.get()?.as_ref()?.language;
435432
Query::new(lang, &query_text)
436-
.map_err(|e| log::error!("Failed to parse {} queries for {}: {}", kind, lang_name, e))
433+
.map_err(|e| {
434+
log::error!(
435+
"Failed to parse {} queries for {}: {}",
436+
kind,
437+
self.language_id,
438+
e
439+
)
440+
})
437441
.ok()
438442
}
439443
}

0 commit comments

Comments
 (0)