sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

XML comment syntax highlighting bug

Open yurikus opened this issue 3 years ago • 1 comments

Version info

  • OS: Win10 22H2 10.0.19045.2130
  • Build: 2077

Description

XML comment syntax highlighting is lost after this line encountered

<!----------------------------> 

Steps to reproduce

Steps to reproduce the behavior:

  • Diff an xml file with content above, also see screenshot below

Screenshots

If applicable, add screenshots to help explain your problem. This section may be omitted/removed. image

yurikus avatar Oct 30 '22 20:10 yurikus

@yurikus, this isn't a bug within the XML syntax highlighting, but an invalid XML document and thus cannot be highlighted as wanted.

Error as seen in the XML spec (https://www.w3.org/TR/xml/#dt-comment):

For compatibility, the string " -- " (double-hyphen) MUST NOT occur within comments.

Note that the grammar does not allow a comment ending in --->.

Due to these two requirements, the ending of the comment cannot be properly identified. If you changed it to the below, the syntax highlighting will work, but it would still be considered invalid XML.

<!-- ------------------------ -->


As an aside, code & issues for the the syntax highlighting portions of Sublime based products reside in sublimehq/Packages.

@dpjohnst, this issue likely should move to Packages, but I thought I should point out the color-scheme bug where the text in the scope invalid.illegal.double-hyphen-within-comment.xml is white (makes sense due to SM overriding highlighting from ST's white-on-red invalid text).

srbs avatar Nov 02 '22 11:11 srbs