[highlights] restrict hash highlights to certain text formats

Related to #575
pull/1265/head
Tim Stack 2 months ago
parent 8106626c91
commit 299757212a

@ -431,14 +431,22 @@ setup_highlights(highlight_map_t& hm)
= highlighter(xpcre_compile("^\\@@ .*")) = highlighter(xpcre_compile("^\\@@ .*"))
.with_role(role_t::VCR_DIFF_SECTION); .with_role(role_t::VCR_DIFF_SECTION);
hm[{highlight_source_t::INTERNAL, "0.comment"}] hm[{highlight_source_t::INTERNAL, "0.comment"}]
= highlighter( = highlighter(xpcre_compile(R"((?<=[\s;]|^)//.*|/\*.*\*/|\(\*.*\*\))"))
xpcre_compile(
R"((?<=[\s;]|^)//.*|/\*.*\*/|\(\*.*\*\)|^\s*#(?!\s*(?:include|if|ifndef|elif|else|endif|error|pragma|define|undef)\b).*|dnl.*)"))
.with_nestable(false) .with_nestable(false)
.with_text_format(text_format_t::TF_C_LIKE)
.with_text_format(text_format_t::TF_JAVA)
.with_text_format(text_format_t::TF_RUST)
.with_role(role_t::VCR_COMMENT); .with_role(role_t::VCR_COMMENT);
hm[{highlight_source_t::INTERNAL, "z.comment"}] hm[{highlight_source_t::INTERNAL, ".comment"}]
= highlighter(xpcre_compile(R"(\s+#.*)")) = highlighter(
xpcre_compile(
R"((?:\s+#.*|^\s*#(?!\s*(?:include|if|ifndef|elif|else|endif|error|pragma|define|undef)\b).*|dnl.*))"))
.with_nestable(false) .with_nestable(false)
.with_text_format(text_format_t::TF_SHELL_SCRIPT)
.with_text_format(text_format_t::TF_PYTHON)
.with_text_format(text_format_t::TF_MAKEFILE)
.with_text_format(text_format_t::TF_YAML)
.with_text_format(text_format_t::TF_TOML)
.with_role(role_t::VCR_COMMENT); .with_role(role_t::VCR_COMMENT);
hm[{highlight_source_t::INTERNAL, "javadoc"}] hm[{highlight_source_t::INTERNAL, "javadoc"}]
= highlighter( = highlighter(

Loading…
Cancel
Save