diff --git a/ASP/syntax_test_asp.asp b/ASP/syntax_test_asp.asp index 648892ac8f..e115c0992b 100644 --- a/ASP/syntax_test_asp.asp +++ b/ASP/syntax_test_asp.asp @@ -161,9 +161,8 @@ Dim var = 0 ' ^^^^^^^^^^^^^^^^^ source.asp.embedded.html - meta.tag --> - ' <- source.asp.embedded.html - '^^^ source.asp.embedded.html - ' ^^^^ - meta.tag - source + ' <- - source + '^^^^^^^ - meta.tag - source ' ^^^ comment.block.html punctuation.definition.comment.end.html ' ^^^^^^^ meta.tag - source @@ -200,11 +199,11 @@ - ' ^ source.css.embedded.html - comment + ' ^ - comment - source ' ^^^ comment.block.html punctuation.definition.comment.end.html - source ' ^ - meta.tag - comment - source diff --git a/HTML/HTML.sublime-syntax b/HTML/HTML.sublime-syntax index b32d70ca2d..600b1db80e 100644 --- a/HTML/HTML.sublime-syntax +++ b/HTML/HTML.sublime-syntax @@ -142,8 +142,9 @@ variables: # - https://github.com/sublimehq/sublime_text/issues/4701 script_content_begin: |- (?x: - # whitespace followed by opening html comment begin punctuation - \s*() \s* )? (?= tag + (?: (?: ^ \s* | (\s*) ) (-->) \s* | ^ \s* )? (?=) \s* $ + # note: Keep empty capture group for compatibility with existing 3rd-party syntaxes! + | ^ \s* () (-->) \s* $ ) style_content_begin: '{{script_content_begin}}' style_content_end: |- (?x: - # optional html comment end punctuation followed by tag - (?: (\s*) (-->) \s* )? (?= tag + (?: (?: ^ \s* | (\s*) ) (-->) \s* | ^ \s* )? (?=) \s* $ + # note: Keep empty capture group for compatibility with existing 3rd-party syntaxes! + | ^ \s* () (-->) \s* $ ) event_attribute_names: |- diff --git a/HTML/Indentation Rules - Comments.tmPreferences b/HTML/Indentation Rules - Comments.tmPreferences new file mode 100644 index 0000000000..5e3d565e86 --- /dev/null +++ b/HTML/Indentation Rules - Comments.tmPreferences @@ -0,0 +1,13 @@ + + + + scope + text.html comment.block.html + settings + + + unIndentedLinePattern + ^(?!\s*-->) + + + diff --git a/HTML/Indentation Rules.tmPreferences b/HTML/Indentation Rules.tmPreferences index bdc5bdaf16..cea75c36b9 100644 --- a/HTML/Indentation Rules.tmPreferences +++ b/HTML/Indentation Rules.tmPreferences @@ -12,8 +12,9 @@ ^[^<>]*+ ])[^\t\n\f /<>]+ [^>]* > | ^[\t\n\f ]*+ ( - # closing comment punctuation, optionally preceded by an end "comment selector" - ( + # the beginning of the line followed by closing HTML comment + # and or tag + --> [\t\n\f ]* ] # closing directive/section punctuation | [?%]> # closing curly brace @@ -38,8 +39,6 @@ # not closing in the same line (?! .* ) ) - # comments that don't close themselves on the same line - | ) # directives that don't close themselves on the same line | <\?(?!.*?\?>) # sections that don't close themselves on the same line diff --git a/HTML/syntax_test_html.html b/HTML/syntax_test_html.html index 1c49c5cac1..0c1f282e91 100644 --- a/HTML/syntax_test_html.html +++ b/HTML/syntax_test_html.html @@ -62,11 +62,11 @@ - ##^^ source.js.embedded.html - meta.tag - comment + ##^^ - source - meta.tag - comment ## ^^^^ - source - meta.tag ## ^^^ comment.block.html punctuation.definition.comment.end.html var i = 0; @@ -101,11 +101,10 @@ ##^^^^^^ meta.tag.script.begin.html - meta.tag meta.tag - meta.attribute-with-value - source ## ^^^^^^^^^^^^^^^^^^^^^^ meta.tag.script.begin.html meta.attribute-with-value.html - meta.tag meta.tag - meta.attribute-with-value meta.attribute-with-value - source ## ^ meta.tag.script.begin.html - meta.tag meta.tag - meta.attribute-with-value - source - ## ^^^^^ - meta.tag - source + ## ^^^^^^ - meta.tag - source ## ^ entity.name.tag.script ## ^ string.quoted.double.html ## ^^^^ comment.block.html punctuation.definition.comment.begin.html - ## ^ source.js.embedded.html var foo = 100; var baz = function() { ## <- entity.name.function.js @@ -129,6 +128,9 @@ var foo = 100; ## ^^^^^^^^^^^^^^^ source.js.embedded +## <- - source.js.embedded +##^^^^^^ - source.js.embedded +## ^^^^^^^^^ meta.tag.script.end.html +## <- - source.json.embedded +##^^^^^^ - source.json.embedded +## ^^^^^^^^^ meta.tag.script.end.html +## <- - source.json.embedded +##^^^^^^ - source.json.embedded +## ^^^^^^^^^ meta.tag.script.end.html +## <- - source.json.embedded +##^^^^^^ - source.json.embedded +## ^^^^^^^^^ meta.tag.script.end.html +## <- - source.json.embedded +##^^^^^^ - source.json.embedded +## ^^^^^^^^^ meta.tag.script.end.html +## <- - source.json.embedded +##^^^^^^ - source.json.embedded +## ^^^^^^^^^ meta.tag.script.end.html @@ -326,16 +342,19 @@ ## <- source.css.embedded.html ## ^^^^^^^^^^^^^ source.css.embedded.html +## <- - source.css.embedded +##^^^^^^ - source.css.embedded +## ^^^^^^^^ meta.tag.style.end.html @@ -343,8 +362,7 @@ + + @@ -21,6 +61,16 @@ + + foo { bar { diff --git a/Rails/tests/syntax_test_rails.html.erb b/Rails/tests/syntax_test_rails.html.erb index 80c42165f9..8ab3e10b0a 100644 --- a/Rails/tests/syntax_test_rails.html.erb +++ b/Rails/tests/syntax_test_rails.html.erb @@ -39,11 +39,11 @@ -# ^^ source.js.embedded.html - meta.tag - comment +# ^^ - comment - source - meta.tag # ^^^^ - source - meta.tag # ^^^ comment.block.html punctuation.definition.comment.end.html var i = 0;