From fb04102fe36ef24134b63effa1e21688077e5039 Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Sun, 2 May 2021 20:38:42 -0400 Subject: [PATCH] add TODO comment highlighting --- rc/filetype/rust.kak | 8 ++++++-- test/highlight/rust/todo/cmd | 1 + test/highlight/rust/todo/in | 9 +++++++++ test/highlight/rust/todo/rc | 3 +++ test/highlight/rust/todo/script | 7 +++++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 test/highlight/rust/todo/cmd create mode 100644 test/highlight/rust/todo/in create mode 100644 test/highlight/rust/todo/rc create mode 100644 test/highlight/rust/todo/script diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index a388f8de1..9d20a46b0 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -46,7 +46,9 @@ 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 add-highlighter shared/rust/line_doc region //[!/] $ fill documentation -add-highlighter shared/rust/line_comment1 region // $ fill comment +add-highlighter shared/rust/line_comment1 region // $ group +add-highlighter shared/rust/line_comment1/comment fill comment +add-highlighter shared/rust/line_comment1/todo regex (TODO|NOTE|FIXME): 1:meta add-highlighter shared/rust/block_comment2 region -recurse /\*\*\* /\*\*\* \*/ fill comment add-highlighter shared/rust/block_doc region -recurse /\*\* /\*\* \*/ regions @@ -60,7 +62,9 @@ add-highlighter shared/rust/block_doc/doctest/inner/comment regex ^\h*\* 0:docum add-highlighter shared/rust/block_doc/doctest/inner/code ref rust add-highlighter shared/rust/block_doc/code_rest region ``` ``` fill documentation add-highlighter shared/rust/block_doc/doc default-region fill documentation -add-highlighter shared/rust/block_comment1 region -recurse /\* /\* \*/ fill comment +add-highlighter shared/rust/block_comment1 region -recurse /\* /\* \*/ group +add-highlighter shared/rust/block_comment1/comment fill comment +add-highlighter shared/rust/block_comment1/todo regex (TODO|NOTE|FIXME): 1:meta add-highlighter shared/rust/macro_attributes region -recurse "\[" "#!?\[" "\]" regions add-highlighter shared/rust/macro_attributes/ default-region fill meta diff --git a/test/highlight/rust/todo/cmd b/test/highlight/rust/todo/cmd new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/test/highlight/rust/todo/cmd @@ -0,0 +1 @@ + diff --git a/test/highlight/rust/todo/in b/test/highlight/rust/todo/in new file mode 100644 index 000000000..0038aacf5 --- /dev/null +++ b/test/highlight/rust/todo/in @@ -0,0 +1,9 @@ +// TODO: some totally awesome comment +// NOTE: some note +// FIXME: fix some bug + +/* + * TODO: some totally awesome comment + * NOTE: some note + * FIXME: fix some bug + */ diff --git a/test/highlight/rust/todo/rc b/test/highlight/rust/todo/rc new file mode 100644 index 000000000..64064c258 --- /dev/null +++ b/test/highlight/rust/todo/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust diff --git a/test/highlight/rust/todo/script b/test/highlight/rust/todo/script new file mode 100644 index 000000000..7b69edad2 --- /dev/null +++ b/test/highlight/rust/todo/script @@ -0,0 +1,7 @@ +ui_out '{ "jsonrpc": "2.0", "method": "set_ui_options", "params": [{}] }' +ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "attributes": ["final_fg","final_bg"] }, "contents": "/" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": "/ " }, { "face": { "fg": "magenta", "bg": "default", "attributes": [] }, "contents": "TODO" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": ": some totally awesome comment" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }], [{ "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": "// " }, { "face": { "fg": "magenta", "bg": "default", "attributes": [] }, "contents": "NOTE" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": ": some note" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }], [{ "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": "// " }, { "face": { "fg": "magenta", "bg": "default", "attributes": [] }, "contents": "FIXME" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": ": fix some bug" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }], [{ "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": "/*\u000a" }], [{ "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": " * " }, { "face": { "fg": "magenta", "bg": "default", "attributes": [] }, "contents": "TODO" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": ": some totally awesome comment\u000a" }], [{ "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": " * " }, { "face": { "fg": "magenta", "bg": "default", "attributes": [] }, "contents": "NOTE" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": ": some note\u000a" }], [{ "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": " * " }, { "face": { "fg": "magenta", "bg": "default", "attributes": [] }, "contents": "FIXME" }, { "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": ": fix some bug\u000a" }], [{ "face": { "fg": "cyan", "bg": "default", "attributes": [] }, "contents": " */" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "\u000a" }]], { "fg": "default", "bg": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "attributes": [] }] }' +ui_out '{ "jsonrpc": "2.0", "method": "menu_hide", "params": [] }' +ui_out '{ "jsonrpc": "2.0", "method": "info_hide", "params": [] }' +ui_out '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": "out 1:1 " }, { "face": { "fg": "black", "bg": "yellow", "attributes": [] }, "contents": "" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "attributes": [] }] }' +ui_out '{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 0 }] }' +ui_out '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }'