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