textmate / html.tmbundle

TextMate support for HTML
76 stars 95 forks source link

Single `&` is no longer highlighted red. #93

Closed aeschli closed 6 years ago

aeschli commented 6 years ago

From @jamesbellnet on September 4, 2018 9:16

Prior to upgrading VS Code to v1.26.1 (Windows specific version), if I typed the & symbol in body text (in an HTML or PHP file) it would be highlighted in red prompting me to type the correct HTML entity &. Since upgrading to VS Code 1.26.1 it no longer does this.

Things to note:

Any help much appreciated.

Does this issue occur when all extensions are disabled?: Yes

Copied from original issue: Microsoft/vscode#57847

aeschli commented 6 years ago

That's done by the HTML text mate grammar, used for syntax highlighting.It looks like the changed this so that it only gets red once the full entity is typed screenshot from 2018-09-12 12-21-30 screenshot from 2018-09-12 14-46-31

infininight commented 6 years ago

The grammar has been updated to support the HTML5 spec: It allows for & characters to be used 'bare' provided they don't cause an ambiguous ampersand state. Detailed here in the spec and later in the parsing section.

But in short: & characters are now allowed in raw text unless they are followed by alphanumeric characters and then a ; that does not match a valid named character reference. For this reason the grammar now matches all supported named character references exactly, where before it was a loose match.

cc @jamesbellnet