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

XML syntax highlighting fails when double hyphens appear inside multi-line comments #91

@aeschli

Description

@aeschli

From @tommai78101 on September 6, 2018 14:13

System Specs

  • Version: 1.27.0 (user setup)
  • Commit: 7b9afc4196bda60b0facdf62cfc02815509b23d6
  • Date: 2018-09-05T05:29:44.670Z
  • Electron: 2.0.7
  • Chrome: 61.0.3163.100
  • Node.js: 8.9.3
  • V8: 6.1.534.41
  • Architecture: x64
  • OS: Windows 7 LTSB

Description

When you put double hyphens (--) inside multi-line comment blocks in XML files, it breaks the syntax highlighting.

Opinion

Per the following information:

[Definition: Comments may appear anywhere in a document outside other markup; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's character data; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. For compatibility, the string " -- " (double-hyphen) must not occur within comments.] Parameter entity references must not be recognized within comments.

http://www.w3.org/TR/REC-xml/#sec-comments

This is correct indication or correct response to an invalid -- inside XML comments, however, it should only highlight the offending -- in red, but keep the rest of the code with correct syntax highlighting, so it doesn't highlight the remaining code after the offending -- to be green entirely.

Steps to Reproduce:

  1. Copy paste the following XML code in a new XML document in Visual Studio Code:
<?xml version="1.0" encoding="utf-8"?>
<Foo>
	<Class>
		<!-- This is a comment -->
		<Bar>Hello world</Bar>
		<!-- 
			This is a multiple-lines comment.
			Hello comment!
		-->
		<Baz>Goodbye world.</Baz>
		<!-- 
			This is a multiple-lines comment with double hyphens inside it.
			--
		-->
		<Error>Highlighting parsing error</Error>
	</Class>
</Foo>
  1. Observe syntax highlighting breaks after "Goodbye World.".

Image

image

Does this issue occur when all extensions are disabled?: Yes
Does this issue occur when one of the extensions is disabled?: Yes

  • XML Tools 2.3.2

Copied from original issue: microsoft/vscode#58076

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions