Skip to content

Commit 5f563f6

Browse files
committed
Snippet: Fix highlighting of forward slashes in regex
Fixes #241.
1 parent 50840c7 commit 5f563f6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Package/Sublime Text Snippet/Sublime Text Snippet (Raw).sublime-syntax

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ contexts:
6767
- match: (?=/)
6868
pop: true
6969
- match: ''
70-
push: scope:source.regexp
71-
with_prototype:
70+
push:
71+
# Will not work if extended mode is enabled in the regex
72+
- meta_scope: source.regexp.embedded
7273
- match: (?=/)
7374
pop: true
75+
- include: scope:source.regexp#base-literal

Package/Sublime Text Snippet/syntax_test_snippet.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ It is possible to include a literal newline in the replacement: ${1/test/_
206206
#^ keyword.other.regex.end
207207
# ^ keyword.other.block.end
208208
209+
210+
${TM_CURRENT_LINE/^\\s*((?:\\/\\/[\\/!]?|#|%|--|::|(?i:rem)|'|;)\\s*).*/$1/}
211+
# ^ meta.group.regexp meta.group.regexp meta.literal.regexp
212+
# ^ keyword.other.regex.mid.snippet
213+
209214
]]>snippet<</content>
210215
#^^^ meta.tag.cdata punctuation.definition.tag.end
211216
# ^^^^^^^ source.sublime.snippet

0 commit comments

Comments
 (0)