diff --git a/README.md b/README.md index 7657be4..191cf76 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,7 @@ Only a single milestone can be specified. If the milestone does not exist, it wi - ABAP - ABAP CDS +- Agda - AutoHotkey - C - C++ @@ -155,6 +156,7 @@ Only a single milestone can be specified. If the milestone does not exist, it wi - Org Mode - PHP - Python +- PureScript - R - Razor - RMarkdown diff --git a/main.py b/main.py index a635478..a9155eb 100644 --- a/main.py +++ b/main.py @@ -669,11 +669,13 @@ class TodoParser(object): """Try and get the Markdown language and comment syntax data for the given file.""" file_name, extension = os.path.splitext(os.path.basename(file)) for language_name in self.languages_dict: + # Check if the file extension matches the language's extensions. if extension != '' and 'extensions' in self.languages_dict[language_name]: syntax_details, ace_mode = self._get_language_details(language_name, 'extensions', extension) if syntax_details is not None and ace_mode is not None: return syntax_details, ace_mode - elif 'filenames' in self.languages_dict[language_name]: + # Check if the file name matches the language's filenames. + if 'filenames' in self.languages_dict[language_name]: syntax_details, ace_mode = self._get_language_details(language_name, 'filenames', file_name) if syntax_details is not None and ace_mode is not None: return syntax_details, ace_mode diff --git a/syntax.json b/syntax.json index 2567737..8d9a54a 100644 --- a/syntax.json +++ b/syntax.json @@ -242,6 +242,13 @@ "start": "/\\*", "end": "\\*/" } + }, + { + "type": "block", + "pattern": { + "start": "{/\\*", + "end": "\\*/}" + } } ] }, @@ -357,6 +364,22 @@ } ] }, + { + "language": "PureScript", + "markers": [ + { + "type": "line", + "pattern": "--" + }, + { + "type": "block", + "pattern": { + "start": "{-", + "end": "-}" + } + } + ] + }, { "language": "Haskell", "markers": [ @@ -789,5 +812,21 @@ } } ] + }, + { + "language": "Agda", + "markers": [ + { + "type": "line", + "pattern": "--" + }, + { + "type": "block", + "pattern": { + "start": "{-", + "end": "-}" + } + } + ] } ] diff --git a/tests/test_closed.diff b/tests/test_closed.diff index 8e35037..1422c1e 100644 --- a/tests/test_closed.diff +++ b/tests/test_closed.diff @@ -407,4 +407,63 @@ index 0000000..7cccc5b 100644 -TODO: Render Liquid file {% assign featured_product = all_products["product_handle"] %} {% render "product", product: featured_product %} --{% endcomment %} \ No newline at end of file +-{% endcomment %} +diff --git a/tests/example_file.tsx b/tests/example_file.tsx +index 0000000..7cccc5b 100644 +--- a/tests/example_file.tsx ++++ b/tests/example_file.tsx +@@ -1,7 +1,3 @@ +-// TODO: rename component +-export default async function Component() { ++export default async function MyComponent() { +- /* TODO: Use state here +- labels: client */ ++ const [data, setData] = useState(""); + + return ( +
+- {/* +- TODO: use styled component library +- */} ++ {data} +
+ ); + } +diff --git a/src/Swarm/Game/example.purs b/src/Swarm/Game/example.purs +index 525e25d..ba4e68d 100644 +--- a/src/Swarm/Game/example.purs ++++ b/src/Swarm/Game/example.purs +@@ -1,14 +0,0 @@ +--- | Standard devices that are always installed. +--- +--- TODO: Remove standard devices +--- In the future, make a way to build these and just start the base +--- out with a large supply of each? +--- labels: redesign +-stdDeviceList = +- ["treads", "grabber", "solar panel", "scanner", "plasma cutter"] +- +-{- | Very complicated function. +- +-TODO: Create an issue for TODO +--} +-sum a b = a + b +diff --git a/src/Swarm/Game/example.agda b/src/Swarm/Game/example.agda +index 525e25d..ba4e68d 100644 +--- a/src/Swarm/Game/example.agda ++++ b/src/Swarm/Game/example.agda +@@ -1,14 +0,0 @@ +--- | Standard devices that are always installed. +--- +--- TODO: Remove standard devices +--- In the future, make a way to build these and just start the base +--- out with a large supply of each? +--- labels: redesign +-stdDeviceList = +- ["treads", "grabber", "solar panel", "scanner", "plasma cutter"] +- +-{- | Very complicated function. +- +-TODO: Create an issue for TODO +--} +-sum a b = a + b diff --git a/tests/test_new.diff b/tests/test_new.diff index efba12c..cb2dbd5 100644 --- a/tests/test_new.diff +++ b/tests/test_new.diff @@ -201,6 +201,20 @@ index 0000000..525e25d + # This function should probably do something more interesting + # labels: help wanted + pass +diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel +new file mode 100644 +index 0000000..525e25d +--- /dev/null ++++ b/tests/BUILD.bazel +@@ -0,0 +1,23 @@ ++def hello_world(): ++ # TODO: Come up with a more imaginative greeting ++ print('Hello world') ++ ++ # TODO: Do more stuff ++ # This function should probably do something more interesting ++ # labels: help wanted ++ pass diff --git a/tests/example_file.ahk b/src/tests/example_file.ahk new file mode 100644 index 0000000..7cccc5b @@ -451,4 +465,63 @@ index 0000000..7cccc5b +TODO: Render Liquid file +{% assign featured_product = all_products["product_handle"] %} +{% render "product", product: featured_product %} -+{% endcomment %} \ No newline at end of file ++{% endcomment %} +diff --git a/tests/example_file.tsx b/tests/example_file.tsx +new file mode 100644 +index 0000000..7cccc5b +--- /dev/null ++++ b/tests/example_file.tsx +@@ -0,0 +1,13 @@ ++// TODO: rename component ++export default async function Component() { ++ /* TODO: Use state here ++ labels: client */ ++ ++ return ( ++
++ {/* ++ TODO: use styled component library ++ */} ++
++ ); ++} +diff --git a/src/Swarm/Game/example.purs b/src/Swarm/Game/example.purs +new file mode 100644 +index 0000000..0ce9b1a +--- /dev/null ++++ b/src/Swarm/Game/example.purs +@@ -0,0 +1,14 @@ ++-- | Standard devices that are always installed. ++-- ++-- TODO: Remove standard devices ++-- In the future, make a way to build these and just start the base ++-- out with a large supply of each? ++-- labels: redesign ++stdDeviceList = ++ ["treads", "grabber", "solar panel", "scanner", "plasma cutter"] ++ ++{- | Very complicated function. ++ ++TODO: Create an issue for TODO ++-} ++sum a b = a + b +diff --git a/src/Swarm/Game/example.agda b/src/Swarm/Game/example.agda +new file mode 100644 +index 0000000..0ce9b1a +--- /dev/null ++++ b/src/Swarm/Game/example.agda +@@ -0,0 +1,14 @@ ++-- | Standard devices that are always installed. ++-- ++-- TODO: Remove standard devices ++-- In the future, make a way to build these and just start the base ++-- out with a large supply of each? ++-- labels: redesign ++stdDeviceList = ++ ["treads", "grabber", "solar panel", "scanner", "plasma cutter"] ++ ++{- | Very complicated function. ++ ++TODO: Create an issue for TODO ++-} ++sum a b = a + b diff --git a/tests/test_todo_parser.py b/tests/test_todo_parser.py index 148e711..d64c148 100644 --- a/tests/test_todo_parser.py +++ b/tests/test_todo_parser.py @@ -23,8 +23,8 @@ class NewIssueTests(unittest.TestCase): self.raw_issues = parser.parse(diff_file) def test_python_issues(self): - # Includes 2 tests for Starlark. - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 6) + # Includes 4 tests for Starlark. + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 8) def test_yaml_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'yaml'), 2) @@ -35,11 +35,9 @@ class NewIssueTests(unittest.TestCase): def test_java_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'java'), 2) - def test_json_with_comments_issues(self): - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2) - - def test_json5_issues(self): - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2) + def test_javascript_issues(self): + # Includes 1 test for JSON with Comments, 1 test for JSON5, 3 tests for TSX. + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 5) def test_ruby_issues(self): # Includes 2 tests for Crystal. @@ -58,7 +56,7 @@ class NewIssueTests(unittest.TestCase): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'julia'), 2) def test_starlark_issues(self): - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 6) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 8) def test_autohotkey_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1) @@ -67,7 +65,7 @@ class NewIssueTests(unittest.TestCase): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'handlebars'), 2) def test_org_issues(self): - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'text'), 4) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'text'), 6) def test_scss_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'scss'), 2) @@ -85,7 +83,7 @@ class NewIssueTests(unittest.TestCase): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'r'), 2) def test_haskell_issues(self): - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'haskell'), 2) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'haskell'), 4) def test_clojure_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'clojure'), 2) @@ -144,11 +142,9 @@ class ClosedIssueTests(unittest.TestCase): def test_starlark_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'python'), 5) - def test_json_with_comments_issues(self): - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2) - - def test_json5_issues(self): - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 2) + def test_javascript_issues(self): + # Includes 1 test for JSON with Comments, 1 test for JSON5, 3 tests for TSX. + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'javascript'), 5) def test_autohotkey_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'autohotkey'), 1) @@ -157,7 +153,7 @@ class ClosedIssueTests(unittest.TestCase): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'handlebars'), 2) def test_org_issues(self): - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'text'), 4) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'text'), 6) def test_scss_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'scss'), 2) @@ -175,7 +171,7 @@ class ClosedIssueTests(unittest.TestCase): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'r'), 2) def test_haskell_issues(self): - self.assertEqual(count_issues_for_file_type(self.raw_issues, 'haskell'), 2) + self.assertEqual(count_issues_for_file_type(self.raw_issues, 'haskell'), 4) def test_clojure_issues(self): self.assertEqual(count_issues_for_file_type(self.raw_issues, 'clojure'), 2)