Built-in: Highlighting quality improvements

main
Charlotte Som 2022-04-30 02:49:37 +01:00
parent f105b38723
commit d36feb184f
1 changed files with 11 additions and 6 deletions

View File

@ -121,8 +121,13 @@ pub fn cpp_hl_factory() -> Result<HighlightConfiguration, QueryError> {
tree_sitter_cpp::language(),
&format!(
"{}{}",
tree_sitter_c::HIGHLIGHT_QUERY,
tree_sitter_cpp::HIGHLIGHT_QUERY
tree_sitter_cpp::HIGHLIGHT_QUERY,
tree_sitter_c::HIGHLIGHT_QUERY
.replace(
"(null) @constant",
"(true) @constant\n(false) @constant\n(null) @constant"
)
.replace("(primitive_type) @type", "(primitive_type) @type.builtin"),
),
"",
"",
@ -134,14 +139,14 @@ pub fn typescript_hl_factory() -> Result<HighlightConfiguration, QueryError> {
tree_sitter_typescript::language_typescript(),
&format!(
"{}{}",
tree_sitter_javascript::HIGHLIGHT_QUERY,
tree_sitter_typescript::HIGHLIGHT_QUERY,
tree_sitter_javascript::HIGHLIGHT_QUERY
),
tree_sitter_javascript::INJECTION_QUERY,
&format!(
"{}{}",
tree_sitter_typescript::LOCALS_QUERY,
tree_sitter_javascript::LOCALS_QUERY,
tree_sitter_typescript::LOCALS_QUERY
),
)
}
@ -151,14 +156,14 @@ pub fn tsx_hl_factory() -> Result<HighlightConfiguration, QueryError> {
tree_sitter_typescript::language_tsx(),
&format!(
"{}{}",
tree_sitter_javascript::HIGHLIGHT_QUERY,
tree_sitter_typescript::HIGHLIGHT_QUERY,
tree_sitter_javascript::HIGHLIGHT_QUERY
),
tree_sitter_javascript::INJECTION_QUERY,
&format!(
"{}{}",
tree_sitter_typescript::LOCALS_QUERY,
tree_sitter_javascript::LOCALS_QUERY,
tree_sitter_typescript::LOCALS_QUERY
),
)
}