From 346e53705e7ec5a7b49454ad14d0a33f00b38eae Mon Sep 17 00:00:00 2001 From: "BANO.notIT" Date: Sat, 22 Oct 2022 16:57:00 +0300 Subject: [PATCH 1/4] feat(syntax): Add Todo.txt syntax --- .gitmodules | 3 +++ assets/syntaxes/02_Extra/TodoTxt | 1 + 2 files changed, 4 insertions(+) create mode 160000 assets/syntaxes/02_Extra/TodoTxt diff --git a/.gitmodules b/.gitmodules index 156f4206..fbcf7db2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -244,3 +244,6 @@ url = https://github.com/victor-gp/cmd-help-sublime-syntax.git branch = main shallow = true +[submodule "assets/syntaxes/02_Extra/TodoTxt"] + path = assets/syntaxes/02_Extra/TodoTxt + url = https://github.com/dertuxmalwieder/SublimeTodoTxt diff --git a/assets/syntaxes/02_Extra/TodoTxt b/assets/syntaxes/02_Extra/TodoTxt new file mode 160000 index 00000000..f5f0a6c4 --- /dev/null +++ b/assets/syntaxes/02_Extra/TodoTxt @@ -0,0 +1 @@ +Subproject commit f5f0a6c47f8948193f5e185576d49379a1438077 From 1a85b4c3b519e14139bf7064447d12ca8d707912 Mon Sep 17 00:00:00 2001 From: "BANO.notIT" Date: Sat, 22 Oct 2022 16:59:19 +0300 Subject: [PATCH 2/4] test(syntax): Add partially working test --- .../highlighted/Todo.txt/todo.txt | 65 +++++++++++++++++++ tests/syntax-tests/source/Todo.txt/todo.txt | 65 +++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 tests/syntax-tests/highlighted/Todo.txt/todo.txt create mode 100644 tests/syntax-tests/source/Todo.txt/todo.txt diff --git a/tests/syntax-tests/highlighted/Todo.txt/todo.txt b/tests/syntax-tests/highlighted/Todo.txt/todo.txt new file mode 100644 index 00000000..6d066ebc --- /dev/null +++ b/tests/syntax-tests/highlighted/Todo.txt/todo.txt @@ -0,0 +1,65 @@ +Rule 1.1: Priority + +/// Should have priority /// +(A) Thank Mom for the meatballs @phone +(B) Schedule Goodwill pickup +GarageSale @phone + +/// Should not have priority /// +Really gotta call Mom (A) @phone @someday +(b) Get back to the boss +(B)->Submit TPS report + + +Rule 1.2: Creation date + +/// Date should be after priority /// +2011-03-02 Document +TodoTxt task format +(A) 2011-03-02 Call Mom + +/// Should not have creation date /// +(A) Call Mom 2011-03-02 + + +Rule 1.3: Context and Projects  + +/// Contexts and projects can appear anywhere /// +(A) Call Mom +Family +PeaceLoveAndHappiness @iphone @phone to celebrate! + +/// No context /// +Email SoAndSo at soandso@example.com + +/// No project /// +Learn how to add 2+2 + + +Rule 2.1: Completed task + +/// Complete task /// +x 2011-03-03 Call Mom +x With @contexts +projects and key:value + +/// Not completed tasks /// +xylophone lesson +X 2012-01-01 Make resolutions +(A) x Find ticket prices + + +Rule 2.2: Completion date + +/// Only completion date is valuable /// +x Completion date is optional +x 2022-10-21 But you can specify it +x 2011-03-02 2011-03-01  + + +Additional definition + +/// Properties /// +Decide on present for Mom due:2022-01-01 pri:1 + + + +Unspecified + +/// Delayed tasks with WAIT keyword /// +WAIT for @Patric to finish his task with +program diff --git a/tests/syntax-tests/source/Todo.txt/todo.txt b/tests/syntax-tests/source/Todo.txt/todo.txt new file mode 100644 index 00000000..bd4bb908 --- /dev/null +++ b/tests/syntax-tests/source/Todo.txt/todo.txt @@ -0,0 +1,65 @@ +Rule 1.1: Priority + +/// Should have priority /// +(A) Thank Mom for the meatballs @phone +(B) Schedule Goodwill pickup +GarageSale @phone + +/// Should not have priority /// +Really gotta call Mom (A) @phone @someday +(b) Get back to the boss +(B)->Submit TPS report + + +Rule 1.2: Creation date + +/// Date should be after priority /// +2011-03-02 Document +TodoTxt task format +(A) 2011-03-02 Call Mom + +/// Should not have creation date /// +(A) Call Mom 2011-03-02 + + +Rule 1.3: Context and Projects + +/// Contexts and projects can appear anywhere /// +(A) Call Mom +Family +PeaceLoveAndHappiness @iphone @phone to celebrate! + +/// No context /// +Email SoAndSo at soandso@example.com + +/// No project /// +Learn how to add 2+2 + + +Rule 2.1: Completed task + +/// Complete task /// +x 2011-03-03 Call Mom +x With @contexts +projects and key:value + +/// Not completed tasks /// +xylophone lesson +X 2012-01-01 Make resolutions +(A) x Find ticket prices + + +Rule 2.2: Completion date + +/// Only completion date is valuable /// +x Completion date is optional +x 2022-10-21 But you can specify it +x 2011-03-02 2011-03-01 + + +Additional definition + +/// Properties /// +Decide on present for Mom due:2022-01-01 pri:1 + + + +Unspecified + +/// Delayed tasks with WAIT keyword /// +WAIT for @Patric to finish his task with +program From 316f1b36012459fee62fc8d7c273bf0ce616b6f4 Mon Sep 17 00:00:00 2001 From: "BANO.notIT" Date: Sat, 22 Oct 2022 17:06:27 +0300 Subject: [PATCH 3/4] test(syntax): Generate normal highlight for bat --- .../highlighted/Todo.txt/todo.txt | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/syntax-tests/highlighted/Todo.txt/todo.txt b/tests/syntax-tests/highlighted/Todo.txt/todo.txt index 6d066ebc..56d7067d 100644 --- a/tests/syntax-tests/highlighted/Todo.txt/todo.txt +++ b/tests/syntax-tests/highlighted/Todo.txt/todo.txt @@ -1,65 +1,65 @@ -Rule 1.1: Priority +Rule 1.1: Priority -/// Should have priority /// -(A) Thank Mom for the meatballs @phone -(B) Schedule Goodwill pickup +GarageSale @phone +/// Should have priority /// +(A) Thank Mom for the meatballs @phone +(B) Schedule Goodwill pickup +GarageSale @phone -/// Should not have priority /// -Really gotta call Mom (A) @phone @someday -(b) Get back to the boss -(B)->Submit TPS report +/// Should not have priority /// +Really gotta call Mom (A) @phone @someday +(b) Get back to the boss +(B)->Submit TPS report -Rule 1.2: Creation date +Rule 1.2: Creation date -/// Date should be after priority /// -2011-03-02 Document +TodoTxt task format -(A) 2011-03-02 Call Mom +/// Date should be after priority /// +2011-03-02 Document +TodoTxt task format +(A) 2011-03-02 Call Mom -/// Should not have creation date /// -(A) Call Mom 2011-03-02 +/// Should not have creation date /// +(A) Call Mom 2011-03-02 -Rule 1.3: Context and Projects  +Rule 1.3: Context and Projects  -/// Contexts and projects can appear anywhere /// -(A) Call Mom +Family +PeaceLoveAndHappiness @iphone @phone to celebrate! +/// Contexts and projects can appear anywhere /// +(A) Call Mom +Family +PeaceLoveAndHappiness @iphone @phone to celebrate! -/// No context /// -Email SoAndSo at soandso@example.com +/// No context /// +Email SoAndSo at soandso@example.com -/// No project /// -Learn how to add 2+2 +/// No project /// +Learn how to add 2+2 -Rule 2.1: Completed task +Rule 2.1: Completed task -/// Complete task /// -x 2011-03-03 Call Mom -x With @contexts +projects and key:value +/// Complete task /// +x 2011-03-03 Call Mom +x With @contexts +projects and key:value -/// Not completed tasks /// -xylophone lesson -X 2012-01-01 Make resolutions -(A) x Find ticket prices +/// Not completed tasks /// +xylophone lesson +X 2012-01-01 Make resolutions +(A) x Find ticket prices -Rule 2.2: Completion date +Rule 2.2: Completion date -/// Only completion date is valuable /// -x Completion date is optional -x 2022-10-21 But you can specify it -x 2011-03-02 2011-03-01  +/// Only completion date is valuable /// +x Completion date is optional +x 2022-10-21 But you can specify it +x 2011-03-02 2011-03-01  -Additional definition +Additional definition -/// Properties /// -Decide on present for Mom due:2022-01-01 pri:1 +/// Properties /// +Decide on present for Mom due:2022-01-01 pri:1 -Unspecified +Unspecified -/// Delayed tasks with WAIT keyword /// -WAIT for @Patric to finish his task with +program +/// Delayed tasks with WAIT keyword /// +WAIT for @Patric to finish his task with +program From 31f964f4685fbb784f30dd8b7445b37295e582ec Mon Sep 17 00:00:00 2001 From: "BANO.notIT" Date: Sat, 29 Oct 2022 16:55:46 +0300 Subject: [PATCH 4/4] fix(syntax): Use variable.other for TodoTxt attrs --- assets/patches/TodoTxt.sublime-syntax.patch | 13 +++++++++++++ tests/syntax-tests/highlighted/Todo.txt/todo.txt | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 assets/patches/TodoTxt.sublime-syntax.patch diff --git a/assets/patches/TodoTxt.sublime-syntax.patch b/assets/patches/TodoTxt.sublime-syntax.patch new file mode 100644 index 00000000..81a6d2e0 --- /dev/null +++ b/assets/patches/TodoTxt.sublime-syntax.patch @@ -0,0 +1,13 @@ +diff --git syntaxes/02_Extra/TodoTxt/TodoTxt.sublime-syntax syntaxes/02_Extra/TodoTxt/TodoTxt.sublime-syntax +index 6c75dbb..0115978 100644 +--- syntaxes/02_Extra/TodoTxt/TodoTxt.sublime-syntax ++++ syntaxes/02_Extra/TodoTxt/TodoTxt.sublime-syntax +@@ -68,7 +68,7 @@ contexts: + + - match: (\s+[^\s:]+:[^\s:]+)+\s*$ + comment: Custom attributes +- scope: variable.annotation.todotxt.attribute ++ scope: variable.other.todotxt.attribute + + comments: + # Comments begin with a '//' and finish at the end of the line. diff --git a/tests/syntax-tests/highlighted/Todo.txt/todo.txt b/tests/syntax-tests/highlighted/Todo.txt/todo.txt index 56d7067d..561f3336 100644 --- a/tests/syntax-tests/highlighted/Todo.txt/todo.txt +++ b/tests/syntax-tests/highlighted/Todo.txt/todo.txt @@ -36,7 +36,7 @@ /// Complete task /// x 2011-03-03 Call Mom -x With @contexts +projects and key:value +x With @contexts +projects and key:value /// Not completed tasks /// xylophone lesson @@ -55,7 +55,7 @@ Additional definition /// Properties /// -Decide on present for Mom due:2022-01-01 pri:1 +Decide on present for Mom due:2022-01-01 pri:1