cli: fix syntax highlighting

There was mishap in updating the parameters of highlight configuration – so many
string types!

This is fixed by adding the correct `name` parameter, reusing the `language`
variable that is being matched on.
This commit is contained in:
Fintan Halpenny 2024-12-03 16:13:14 +00:00 committed by cloudhead
parent 7ed72ec918
commit 19bbdbca24
No known key found for this signature in database
1 changed files with 13 additions and 13 deletions

View File

@ -221,130 +221,130 @@ impl Highlighter {
"rust" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_rust::LANGUAGE.into(),
language,
tree_sitter_rust::HIGHLIGHTS_QUERY,
tree_sitter_rust::INJECTIONS_QUERY,
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"json" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_json::LANGUAGE.into(),
language,
tree_sitter_json::HIGHLIGHTS_QUERY,
"",
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"typescript" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_typescript::LANGUAGE_TYPESCRIPT.into(),
language,
tree_sitter_typescript::HIGHLIGHTS_QUERY,
"",
tree_sitter_typescript::LOCALS_QUERY,
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"markdown" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_md::LANGUAGE.into(),
language,
tree_sitter_md::HIGHLIGHT_QUERY_BLOCK,
tree_sitter_md::INJECTION_QUERY_BLOCK,
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"css" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_css::LANGUAGE.into(),
language,
tree_sitter_css::HIGHLIGHTS_QUERY,
"",
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"go" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_go::LANGUAGE.into(),
language,
tree_sitter_go::HIGHLIGHTS_QUERY,
"",
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"shell" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_bash::LANGUAGE.into(),
language,
tree_sitter_bash::HIGHLIGHT_QUERY,
"",
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"c" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_c::LANGUAGE.into(),
language,
tree_sitter_c::HIGHLIGHT_QUERY,
"",
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"python" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_python::LANGUAGE.into(),
language,
tree_sitter_python::HIGHLIGHTS_QUERY,
"",
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"ruby" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_ruby::LANGUAGE.into(),
language,
tree_sitter_ruby::HIGHLIGHTS_QUERY,
"",
tree_sitter_ruby::LOCALS_QUERY,
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"tsx" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_typescript::LANGUAGE_TSX.into(),
language,
tree_sitter_typescript::HIGHLIGHTS_QUERY,
"",
tree_sitter_typescript::LOCALS_QUERY,
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"html" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_html::LANGUAGE.into(),
language,
tree_sitter_html::HIGHLIGHTS_QUERY,
tree_sitter_html::INJECTIONS_QUERY,
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),
"toml" => Some(self.configs.entry(language).or_insert_with(|| {
ts::HighlightConfiguration::new(
tree_sitter_toml_ng::language(),
language,
tree_sitter_toml_ng::HIGHLIGHTS_QUERY,
"",
"",
"",
)
.expect("Highlighter::config: highlight configuration must be valid")
})),