Skip to content

Releasing v3.2.3 #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)`).
Expand Down
4 changes: 2 additions & 2 deletions color-schemes/Mariana.sublime-color-scheme
Original file line number Diff line number Diff line change
Expand Up @@ -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%))"
},
{
Expand Down
6 changes: 3 additions & 3 deletions color-schemes/Monokai.sublime-color-scheme
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 8 additions & 2 deletions commands/mix_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,21 @@ 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())
for regions in all_test_block_regions
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)

Expand Down
10 changes: 10 additions & 0 deletions commands/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down
27 changes: 27 additions & 0 deletions preferences/EEx_Comments.tmPreferences
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>name</key>
<string>EEx Comments</string>
<key>scope</key>
<string>text.eex | text.html.eex | text.html.heex</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string><![CDATA[<%!-- ]]></string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END</string>
<key>value</key>
<string><![CDATA[ --%>]]></string>
</dict>
</array>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<string>Elixir Comments</string>
<key>scope</key>
<string>source.elixir</string>
<key>settings</key>
Expand All @@ -19,4 +19,3 @@
</dict>
</dict>
</plist>

27 changes: 27 additions & 0 deletions preferences/Surface_Comments.tmPreferences
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>name</key>
<string>Surface Comments</string>
<key>scope</key>
<string>text.html.surface</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string><![CDATA[{!-- ]]></string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END</string>
<key>value</key>
<string><![CDATA[ --}]]></string>
</dict>
</array>
</dict>
</dict>
</plist>
28 changes: 18 additions & 10 deletions tests/syntax_test_strings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
\"""<sd>
#^^ constant.character.escape.char.elixir
"""''a
# ^ -string.quoted.modifiers

~L"""
<div class="">
~H"""
<%!-- Comment --%>
# ^^ punctuation.section.embedded.end
# ^^ punctuation.definition.comment.end
# ^^^ punctuation.definition.comment.begin
# ^^ punctuation.section.embedded.begin
# ^^^^^^^^^^^^^^^^^^ meta.embedded comment.block
<div class={@classes}>
# ^^^^^^^^ source.elixir.embedded.html
# ^^^^^^^^^^ meta.attribute-with-value.class.html meta.embedded
<div>
<%= @deploy_step %>
# ^^^^^^^^^^^ variable.other.constant
Expand All @@ -175,7 +183,7 @@ heredoc text
^^text.html.basic
"""

~L"""
~H"""
<div><%= @var %></div>
# ^^^ variable.other.constant.elixir
# ^ -string
Expand All @@ -191,24 +199,24 @@ heredoc text
# ^ storage.type.string
#^^^ punctuation.definition.string.end
#^^^^ meta.string.elixir
~L"<div>\"</div>"m
~H"<div>\"</div>"m
# ^ punctuation.definition.string.end
# ^^ constant.character.escape.char.elixir
# ^^^ entity.name.tag.block.any.html
~L'<div>\'</div>'m
~H'<div>\'</div>'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
# ^ string.quoted.modifiers
# ^ string.quoted.modifiers
# ^ string.quoted.modifiers

~L'''
~H'''
\
^^ text.html.basic -punctuation.separator.continuation
'''m
Expand Down
5 changes: 5 additions & 0 deletions tests/syntax_test_surface.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

<Some.App.Component x={y}>
# ^ punctuation.section.embedded.end.elixir - source.elixir.embedded
# ^ source.elixir.embedded.html
Expand Down
11 changes: 11 additions & 0 deletions tests/syntax_test_template.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
<!-- ^ - punctuation.section.embedded.begin.elixir - source -->
<!-- ^^^^^^^^^^^^^^^^^ - comment.block.html meta.embedded -->

<%!-- Multi-line
<!-- ^^^ punctuation.definition.comment.begin.eex -->
<!-- ^^ punctuation.section.embedded.begin.eex -->
<!-- ^^^^^^^^^^^^^^^^^ meta.embedded.eex -->
<!-- ^^^^^^^^^^^^ comment.block.eex -->
comment --%>
<!-- ^^ punctuation.section.embedded.end.eex -->
<!-- ^^ punctuation.definition.comment.end.eex -->
<!--^^^^^^^^^^^^^^^ comment.block.eex -->
<!--^^^^^^^^^^^^^^^^^^^ meta.embedded.eex -->

<% # Comment %>
<!-- ^^ punctuation.section.embedded.end.eex -->
<!-- ^ punctuation.definition.comment.elixir -->
Expand Down