diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ed4fc30..0dd70c51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [v3.2.3] – 2023-08-13 + +- EEx, HEEx: use `<%!-- ... --%>` when toggling comments. +- EEx, HEEx, Surface: highlight begin and end punctuation marks of comments. +- Commands: fix: filter out already selected tests when using multi-cursor selections. + ## [v3.2.2] – 2023-06-28 - Elixir: fixed module function call regression in captures (`&Map.take(&1, @fields)`). diff --git a/color-schemes/Mariana.sublime-color-scheme b/color-schemes/Mariana.sublime-color-scheme index 3c2cb706..375735d4 100644 --- a/color-schemes/Mariana.sublime-color-scheme +++ b/color-schemes/Mariana.sublime-color-scheme @@ -119,8 +119,8 @@ "foreground": "color(var(white) l(- 30%))" }, { - "name": "Embedded comment punctuation", - "scope": "comment.block.eex & (punctuation.section.embedded.begin.eex | punctuation.section.embedded.end.eex)", + "name": "Surface comment punctuation", + "scope": "punctuation.definition.comment.begin.surface | punctuation.definition.comment.end.surface", "foreground": "color(var(white) l(- 30%))" }, { diff --git a/color-schemes/Monokai.sublime-color-scheme b/color-schemes/Monokai.sublime-color-scheme index 5c87bde4..3a0a0ca3 100644 --- a/color-schemes/Monokai.sublime-color-scheme +++ b/color-schemes/Monokai.sublime-color-scheme @@ -121,9 +121,9 @@ "foreground": "color(var(white) l(- 30%))" }, { - "name": "Embedded comment punctuation", - "scope": "comment.block.eex & (punctuation.section.embedded.begin.eex | punctuation.section.embedded.end.eex)", - "foreground": "color(var(doc))" + "name": "Surface comment punctuation", + "scope": "punctuation.definition.comment.begin.surface | punctuation.definition.comment.end.surface", + "foreground": "color(var(white) l(- 30%))" }, { "name": "SQL boolean", diff --git a/commands/mix_test.py b/commands/mix_test.py index 9efce451..baffec29 100644 --- a/commands/mix_test.py +++ b/commands/mix_test.py @@ -85,8 +85,6 @@ def run(self, _edit): all_test_block_regions = [r for r in all_test_block_regions if r] - grouped_by_describe_dict, _ = group_by_describe_block_regions(all_test_block_regions) - intersecting_test_regions = [ regions for selected_lines_region in map(self.view.line, self.view.sel()) @@ -94,6 +92,14 @@ def run(self, _edit): if regions[-1].intersects(selected_lines_region) ] + unique_intersecting_test_tuples = \ + unique_items([tuple(r.to_tuple() for r in regions) for regions in intersecting_test_regions]) + + intersecting_test_regions = \ + [tuple(sublime.Region(*t) for t in tuples) for tuples in unique_intersecting_test_tuples] + + grouped_by_describe_dict, _ = group_by_describe_block_regions(all_test_block_regions) + grouped_isecting_by_describe_dict, test_to_describe_dict = \ group_by_describe_block_regions(intersecting_test_regions) diff --git a/commands/utils.py b/commands/utils.py index de07345a..6606e3a5 100644 --- a/commands/utils.py +++ b/commands/utils.py @@ -18,6 +18,16 @@ def print_status_msg(msg): print(PRINT_PREFIX, msg) sublime.status_message(PRINT_PREFIX + ' ' + msg) +def unique_items(items): + unique_items, seen_items = [], set() + + for item in items: + if item not in seen_items: + unique_items.append(item) + seen_items.add(item) + + return unique_items + def expand_scope_right(view, begin_point, scope): end_point = next( (pt for pt in range(begin_point, view.size()) if not view.match_selector(pt, scope)), diff --git a/preferences/EEx_Comments.tmPreferences b/preferences/EEx_Comments.tmPreferences new file mode 100644 index 00000000..f1f9d022 --- /dev/null +++ b/preferences/EEx_Comments.tmPreferences @@ -0,0 +1,27 @@ + + + + name + EEx Comments + scope + text.eex | text.html.eex | text.html.heex + settings + + shellVariables + + + name + TM_COMMENT_START + value + + + + name + TM_COMMENT_END + value + ]]> + + + + + diff --git a/preferences/Comments.tmPreferences b/preferences/Elixir_Comments.tmPreferences similarity index 91% rename from preferences/Comments.tmPreferences rename to preferences/Elixir_Comments.tmPreferences index c91a8e5d..07939830 100644 --- a/preferences/Comments.tmPreferences +++ b/preferences/Elixir_Comments.tmPreferences @@ -2,7 +2,7 @@ name - Comments + Elixir Comments scope source.elixir settings @@ -19,4 +19,3 @@ - diff --git a/preferences/Surface_Comments.tmPreferences b/preferences/Surface_Comments.tmPreferences new file mode 100644 index 00000000..36134f22 --- /dev/null +++ b/preferences/Surface_Comments.tmPreferences @@ -0,0 +1,27 @@ + + + + name + Surface Comments + scope + text.html.surface + settings + + shellVariables + + + name + TM_COMMENT_START + value + + + + name + TM_COMMENT_END + value + + + + + + diff --git a/tests/syntax_test_strings.ex b/tests/syntax_test_strings.ex index bd4d8c2f..a44443e0 100644 --- a/tests/syntax_test_strings.ex +++ b/tests/syntax_test_strings.ex @@ -153,19 +153,27 @@ heredoc text ~s"\""m ~s'\''m ~s/\//m ~s|\||m ~s<<\>>m ~s{{\}}m ~s[[\]]m ~s((\))m -## LiveView +## HEEx -~L""''a +~H""''a # ^ -string.quoted.modifiers -~L""" +~H""" ^^^^^ meta.string.elixir text.html.eex text.html.basic \""" #^^ constant.character.escape.char.elixir """''a # ^ -string.quoted.modifiers -~L""" -
+~H""" + <%!-- Comment --%> +# ^^ punctuation.section.embedded.end +# ^^ punctuation.definition.comment.end +# ^^^ punctuation.definition.comment.begin +# ^^ punctuation.section.embedded.begin +# ^^^^^^^^^^^^^^^^^^ meta.embedded comment.block +
+# ^^^^^^^^ source.elixir.embedded.html +# ^^^^^^^^^^ meta.attribute-with-value.class.html meta.embedded
<%= @deploy_step %> # ^^^^^^^^^^^ variable.other.constant @@ -175,7 +183,7 @@ heredoc text ^^text.html.basic """ -~L""" +~H"""
<%= @var %>
# ^^^ variable.other.constant.elixir # ^ -string @@ -191,16 +199,16 @@ heredoc text # ^ storage.type.string #^^^ punctuation.definition.string.end #^^^^ meta.string.elixir -~L"
\"
"m +~H"
\"
"m # ^ punctuation.definition.string.end # ^^ constant.character.escape.char.elixir # ^^^ entity.name.tag.block.any.html -~L'
\'
'm +~H'
\'
'm # ^ punctuation.definition.string.end # ^^ constant.character.escape.char.elixir # ^^^ entity.name.tag.block.any.html - ~L/\//m ~L|\||m ~L{\}}m ~L[\]]m ~L<\>>m ~L(\))m + ~H/\//m ~H|\||m ~H{\}}m ~H[\]]m ~H<\>>m ~H(\))m # ^ string.quoted.modifiers # ^ string.quoted.modifiers # ^ string.quoted.modifiers @@ -208,7 +216,7 @@ heredoc text # ^ string.quoted.modifiers # ^ string.quoted.modifiers -~L''' +~H''' \ ^^ text.html.basic -punctuation.separator.continuation '''m diff --git a/tests/syntax_test_surface.ex b/tests/syntax_test_surface.ex index e91418d2..7ce0676e 100644 --- a/tests/syntax_test_surface.ex +++ b/tests/syntax_test_surface.ex @@ -6,6 +6,11 @@ #^^ meta.string.elixir storage.type.string.elixir # ^^^ meta.string.elixir punctuation.definition.string.begin.elixir + {!-- Comment --} +# ^^^ punctuation.definition.comment.end.surface +# ^^^^ punctuation.definition.comment.begin.surface +# ^^^^^^^^^^^^^^^^ meta.embedded.surface comment.block.surface + # ^ punctuation.section.embedded.end.elixir - source.elixir.embedded # ^ source.elixir.embedded.html diff --git a/tests/syntax_test_template.html.heex b/tests/syntax_test_template.html.heex index b5ba8426..e4a3c045 100644 --- a/tests/syntax_test_template.html.heex +++ b/tests/syntax_test_template.html.heex @@ -18,6 +18,17 @@ + <%!-- Multi-line + + + + + comment --%> + + + + + <% # Comment %>