Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 55af017

Browse files
committed
Revert "Add support for ES6 HTML-style comments"
This reverts commit bb0df12.
1 parent bb0df12 commit 55af017

File tree

2 files changed

+12
-70
lines changed

2 files changed

+12
-70
lines changed

Diff for: grammars/javascript.cson

+12-37
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,15 @@
803803
{
804804
'include': '#comments'
805805
}
806+
{
807+
'captures':
808+
'0':
809+
'name': 'punctuation.definition.comment.html.js'
810+
'2':
811+
'name': 'punctuation.definition.comment.html.js'
812+
'match': '(<!--|-->)'
813+
'name': 'comment.block.html.js'
814+
}
806815
{
807816
'match': '(?<!\\.)\\b(class|enum|function|interface)(?!\\s*:)\\b'
808817
'name': 'storage.type.js'
@@ -1620,15 +1629,15 @@
16201629
'include': '#docblock'
16211630
}
16221631
]
1623-
'end': '\\*/|(?=</script>)' # Unfortunately, we don't know when we're embedded, so this is as good as it gets
1632+
'end': '\\*/'
16241633
'name': 'comment.block.documentation.js'
16251634
}
16261635
{
16271636
'begin': '/\\*'
16281637
'captures':
16291638
'0':
16301639
'name': 'punctuation.definition.comment.js'
1631-
'end': '\\*/|(?=</script>)' # Unfortunately, we don't know when we're embedded, so this is as good as it gets
1640+
'end': '\\*/'
16321641
'name': 'comment.block.js'
16331642
}
16341643
{
@@ -1643,43 +1652,9 @@
16431652
'beginCaptures':
16441653
'0':
16451654
'name': 'punctuation.definition.comment.js'
1646-
'end': '$|(?=</script>)' # Unfortunately, we don't know when we're embedded, so this is as good as it gets
1655+
'end': '\\n'
16471656
'name': 'comment.line.double-slash.js'
16481657
}
16491658
]
16501659
}
1651-
{
1652-
'begin': '(^[ \\t]+)?(?=<!--)'
1653-
'beginCaptures':
1654-
'1':
1655-
'name': 'punctuation.whitespace.comment.leading.js'
1656-
'end': '(?!\\G)'
1657-
'patterns': [
1658-
{
1659-
'begin': '<!--'
1660-
'beginCaptures':
1661-
'0':
1662-
'name': 'punctuation.definition.comment.html.js'
1663-
'end': '$|(?=</script>)' # Unfortunately, we don't know when we're embedded, so this is as good as it gets
1664-
'name': 'comment.line.html.js'
1665-
}
1666-
]
1667-
}
1668-
{
1669-
'begin': '(^[ \\t]+)?(?=-->)'
1670-
'beginCaptures':
1671-
'1':
1672-
'name': 'punctuation.whitespace.comment.leading.js'
1673-
'end': '(?!\\G)'
1674-
'patterns': [
1675-
{
1676-
'begin': '-->'
1677-
'beginCaptures':
1678-
'0':
1679-
'name': 'punctuation.definition.comment.html.js'
1680-
'end': '$|(?=</script>)' # Unfortunately, we don't know when we're embedded, so this is as good as it gets
1681-
'name': 'comment.line.html.js'
1682-
}
1683-
]
1684-
}
16851660
]

Diff for: spec/javascript-spec.coffee

-33
Original file line numberDiff line numberDiff line change
@@ -1563,39 +1563,6 @@ describe "Javascript grammar", ->
15631563
expect(tokens[7]).toEqual value: ', p2 ', scopes: ['source.js', 'meta.function.js', 'meta.parameters.js', 'comment.block.js']
15641564
expect(tokens[8]).toEqual value: '*/', scopes: ['source.js', 'meta.function.js', 'meta.parameters.js', 'comment.block.js', 'punctuation.definition.comment.js']
15651565

1566-
it "tokenizes HTML-style comments correctly", ->
1567-
{tokens} = grammar.tokenizeLine '<!-- comment'
1568-
expect(tokens[0]).toEqual value: '<!--', scopes: ['source.js', 'comment.line.html.js', 'punctuation.definition.comment.html.js']
1569-
expect(tokens[1]).toEqual value: ' comment', scopes: ['source.js', 'comment.line.html.js']
1570-
1571-
{tokens} = grammar.tokenizeLine '--> comment'
1572-
expect(tokens[0]).toEqual value: '-->', scopes: ['source.js', 'comment.line.html.js', 'punctuation.definition.comment.html.js']
1573-
expect(tokens[1]).toEqual value: ' comment', scopes: ['source.js', 'comment.line.html.js']
1574-
1575-
it "stops comments when a </script> tag is encountered", ->
1576-
# HTML doesn't count comments if they're followed by a </script> tag. Unfortunately we have
1577-
# no idea if we're embedded or not, so we err on the side of caution and always assume that we are :/
1578-
1579-
{tokens} = grammar.tokenizeLine '/* </script>'
1580-
expect(tokens[0]).toEqual value: '/*', scopes: ['source.js', 'comment.block.js', 'punctuation.definition.comment.js']
1581-
expect(tokens[1]).not.toEqual value: ' </script>', scopes: ['source.js', 'comment.block.js']
1582-
1583-
{tokens} = grammar.tokenizeLine '/** </script>'
1584-
expect(tokens[0]).toEqual value: '/**', scopes: ['source.js', 'comment.block.documentation.js', 'punctuation.definition.comment.js']
1585-
expect(tokens[1]).not.toEqual value: ' </script>', scopes: ['source.js', 'comment.block.documentation.js']
1586-
1587-
{tokens} = grammar.tokenizeLine '// </script>'
1588-
expect(tokens[0]).toEqual value: '//', scopes: ['source.js', 'comment.line.double-slash.js', 'punctuation.definition.comment.js']
1589-
expect(tokens[1]).not.toEqual value: ' </script>', scopes: ['source.js', 'comment.line.double-slash.js']
1590-
1591-
{tokens} = grammar.tokenizeLine '<!-- </script>'
1592-
expect(tokens[0]).toEqual value: '<!--', scopes: ['source.js', 'comment.line.html.js', 'punctuation.definition.comment.html.js']
1593-
expect(tokens[1]).not.toEqual value: ' </script>', scopes: ['source.js', 'comment.line.html.js']
1594-
1595-
{tokens} = grammar.tokenizeLine '--> </script>'
1596-
expect(tokens[0]).toEqual value: '-->', scopes: ['source.js', 'comment.line.html.js', 'punctuation.definition.comment.html.js']
1597-
expect(tokens[1]).not.toEqual value: ' </script>', scopes: ['source.js', 'comment.line.html.js']
1598-
15991566
describe "console", ->
16001567
it "tokenizes the console keyword", ->
16011568
{tokens} = grammar.tokenizeLine('console;')

0 commit comments

Comments
 (0)