From 8a959497b1fab35294d8ccfa5e51c80a3551a224 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Mon, 19 Apr 2021 11:41:45 +0200 Subject: Don't require all doc fences to be valid for identifying rust code --- crates/ide/src/syntax_highlighting/inject.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crates/ide/src/syntax_highlighting') diff --git a/crates/ide/src/syntax_highlighting/inject.rs b/crates/ide/src/syntax_highlighting/inject.rs index 855c7fba8..6b1037870 100644 --- a/crates/ide/src/syntax_highlighting/inject.rs +++ b/crates/ide/src/syntax_highlighting/inject.rs @@ -85,6 +85,8 @@ const RUSTDOC_FENCE_TOKENS: &[&'static str] = &[ "ignore", "no_run", "compile_fail", + "allow_fail", + "test_harness", "edition2015", "edition2018", "edition2021", @@ -181,7 +183,7 @@ pub(super) fn doc_comment( is_codeblock = !is_codeblock; // Check whether code is rust by inspecting fence guards let guards = &line[idx + RUSTDOC_FENCE.len()..]; - let is_rust = guards.split(',').all(|sub| is_rustdoc_fence_token(sub.trim())); + let is_rust = guards.split(',').any(|sub| is_rustdoc_fence_token(sub.trim())); is_doctest = is_codeblock && is_rust; continue; } -- cgit v1.2.3