diff --git a/CHANGELOG.md b/CHANGELOG.md index 737a894..0cacaa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ### Changed +- Fix existing test cases for hamlet and add Hamlet testcases (interpolation and conditional) [#25](https://github.com/e-bigmoon/vscode-language-yesod/pull/25) @isao-takejib - Changed to also use Haskell syntax files for testing [#38](https://github.com/e-bigmoon/vscode-language-yesod/pull/38) @isao-takejib - Add a badge for github actions [#36](https://github.com/e-bigmoon/vscode-language-yesod/pull/36) @isao-takejib - Fixing test cases [#35](https://github.com/e-bigmoon/vscode-language-yesod/pull/35) @isao-takejib diff --git a/syntaxes/hamlet.tmLanguage.json b/syntaxes/hamlet.tmLanguage.json index b6b7bc2..98850a7 100644 --- a/syntaxes/hamlet.tmLanguage.json +++ b/syntaxes/hamlet.tmLanguage.json @@ -47,13 +47,18 @@ "keyword": { "patterns": [ { - "match": "\\$(else|nothing|doctype|newline)\\s+", - "name": "keyword.control.hamlet" + "match": "(\\$(else|nothing|doctype|newline))\\s+", + "captures": { + "1": { + "name": "keyword.control.hamlet" + } + }, + "name": "meta.interpolation.hamlet" }, { - "begin": "\\$(if|elseif|maybe|forall|case|of|with)\\s+", + "begin": "(\\$(if|elseif|maybe|forall|case|of|with))\\s+", "beginCaptures": { - "0": { + "1": { "name": "keyword.control.hamlet" } }, diff --git a/test/tests/hamlet/conditionals.hamlet b/test/tests/hamlet/conditionals.hamlet new file mode 100644 index 0000000..561c265 --- /dev/null +++ b/test/tests/hamlet/conditionals.hamlet @@ -0,0 +1,24 @@ +$# SYNTAX TEST "source.yesod.hamlet" "conditionals" +$if isAdmin +$# <--- meta.interpolation.hamlet keyword.control.hamlet +$# ^ - keyword.control.hamlet +$# ^^^^^^^ meta.interpolation.hamlet source.haskell.embedded +
Welcome to the admin section. +$# ^ meta.tag.hamlet punctuation.definition.tag.begin.hamlet +$# ^ meta.tag.hamlet entity.name.tag.hamlet +$# ^ meta.tag.hamlet punctuation.definition.tag.end.hamlet +$elseif isLoggedIn +$# <------- meta.interpolation.hamlet keyword.control.hamlet +$# ^ - keyword.control.hamlet +$# ^^^^^^^^^^ meta.interpolation.hamlet source.haskell.embedded +
You are not the administrator. +$# ^ meta.tag.hamlet punctuation.definition.tag.begin.hamlet +$# ^ meta.tag.hamlet entity.name.tag.hamlet +$# ^ meta.tag.hamlet punctuation.definition.tag.end.hamlet +$else +$# <---- meta.interpolation.hamlet keyword.control.hamlet +$# ^ - keyword.control.hamlet +
I don't know who you are. Please log in so I can decide if you get access. +$# ^ meta.tag.hamlet punctuation.definition.tag.begin.hamlet +$# ^ meta.tag.hamlet entity.name.tag.hamlet +$# ^ meta.tag.hamlet punctuation.definition.tag.end.hamlet diff --git a/test/tests/hamlet/interpolation.hamlet b/test/tests/hamlet/interpolation.hamlet new file mode 100644 index 0000000..7d6663a --- /dev/null +++ b/test/tests/hamlet/interpolation.hamlet @@ -0,0 +1,12 @@ +$# SYNTAX TEST "source.yesod.hamlet" "interpolation" +
+$# <- meta.tag.hamlet punctuation.definition.tag.begin.hamlet +$# <~---- meta.tag.hamlet entity.name.tag.hamlet +$# ^ meta.tag.hamlet punctuation.definition.tag.end.hamlet +