From eac59863231af50d65eaba60b6a1acef31635923 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Tue, 2 Jun 2020 22:03:37 +0800 Subject: [PATCH] Fix rust doctest non-hidden macro highlight --- rc/filetype/rust.kak | 3 +-- test/highlight/rust/comment/in | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index b7e0e8f07..8a57ce9e9 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -39,10 +39,9 @@ add-highlighter shared/rust/line_doctest region ^\h*//[!/]\h*```($|should_panic| add-highlighter shared/rust/line_doctest/marker region ```.* $ group add-highlighter shared/rust/line_doctest/marker/fence regex ``` 0:meta add-highlighter shared/rust/line_doctest/marker/keywords regex [\d\w] 0:meta # already matched above, just ignore comma -add-highlighter shared/rust/line_doctest/inner region '^\h*//[!/]\h+#' ' ' group +add-highlighter shared/rust/line_doctest/inner region '^\h*//[!/]( #(?= )|)' ' ' group add-highlighter shared/rust/line_doctest/inner/comment regex //[!/] 0:documentation add-highlighter shared/rust/line_doctest/inner/hidden regex '#' 0:meta -add-highlighter shared/rust/line_doctest/comment region ^\h*//[!/] ' ' fill documentation add-highlighter shared/rust/line_doctest/code default-region ref rust add-highlighter shared/rust/line_code_rest region ^\h*//[!/]\h*``` ^\h*//[!/]\h*```$ fill documentation # reset invalid doctest add-highlighter shared/rust/line_comment2 region //[!/]{2} $ fill comment diff --git a/test/highlight/rust/comment/in b/test/highlight/rust/comment/in index 2ce32f0a2..c4dd21134 100644 --- a/test/highlight/rust/comment/in +++ b/test/highlight/rust/comment/in @@ -86,3 +86,19 @@ fn bar(s: &str) { * ``` */ + //! ``` + //! // not hidden # + //! #![feature(x)] + //! # // hidden # + //! # #![feature(x)] + //! ``` + + /** + * ``` + * // not hidden # + * #![feature(x)] + * # // hidden # + * # #![feature(x)] + * ``` + */ +