From fd5ab58834a3c52b937a7ae019f90c8a5e2d1f67 Mon Sep 17 00:00:00 2001 From: Nicklas Larsson Date: Fri, 10 May 2024 11:32:26 +0200 Subject: [PATCH] Add support for bracket comment --- Preferences/Comments.tmPreferences | 12 ++++ Syntaxes/CMake Listfile.tmLanguage | 90 ++++++++++++++++++++++++------ 2 files changed, 84 insertions(+), 18 deletions(-) diff --git a/Preferences/Comments.tmPreferences b/Preferences/Comments.tmPreferences index 23f0945..a7afe73 100644 --- a/Preferences/Comments.tmPreferences +++ b/Preferences/Comments.tmPreferences @@ -16,6 +16,18 @@ value # + + name + TM_COMMENT_START_2 + value + #[[ + + + name + TM_COMMENT_END_2 + value + ]] + uuid diff --git a/Syntaxes/CMake Listfile.tmLanguage b/Syntaxes/CMake Listfile.tmLanguage index e0b29a4..2839f1d 100644 --- a/Syntaxes/CMake Listfile.tmLanguage +++ b/Syntaxes/CMake Listfile.tmLanguage @@ -132,35 +132,89 @@ comments - begin - (^[ \t]+)?(?=#) - beginCaptures - - 1 - - name - punctuation.whitespace.comment.leading.cmake - - - end - (?!\G) patterns begin - # + (^[ \t]+)?(?=#\[) beginCaptures - 0 + 1 name - punctuation.definition.comment.cmake + punctuation.whitespace.comment.leading.cmake end - \n - name - comment.line.number-sign.cmake + (?!\G)((?!^)[ \t]+\n)? + endCaptures + + 1 + + name + punctuation.whitespace.comment.trailing.cmake + + + patterns + + + begin + #\[(=+)?\[ + beginCaptures + + 0 + + name + punctuation.definition.comment.begin.cmake + + + end + \]\1\] + endCaptures + + 0 + + name + punctuation.definition.comment.end.cmake + + + name + comment.block.cmake + + + + + begin + (^[ \t]+)?(?=#) + beginCaptures + + 1 + + name + punctuation.whitespace.comment.leading.cmake + + + end + (?!\G) + patterns + + + begin + # + beginCaptures + + 0 + + name + punctuation.definition.comment.cmake + + + end + \n + name + comment.line.number-sign.cmake + +