Skip to content

syntax: keep highlighting after spaced XML empty tags - #4218

Open
justadityaraj wants to merge 1 commit into
micro-editor:masterfrom
justadityaraj:fix/4213-xml-empty-tag-space
Open

syntax: keep highlighting after spaced XML empty tags#4218
justadityaraj wants to merge 1 commit into
micro-editor:masterfrom
justadityaraj:fix/4213-xml-empty-tag-space

Conversation

@justadityaraj

Copy link
Copy Markdown

Context

The XML syntax started an attribute identifier on every literal space and then waited for an equals sign. A space before /> therefore opened an identifier region that never ended, causing its highlighting state to carry into following lines.

Changes

  • Require a valid XML NameStartChar after spaces or tabs before starting an attribute identifier.
  • Add a regression that verifies text after a spaced empty tag does not inherit the identifier style.

User impact

XML documents using the common <tag attr="value" /> form retain correct syntax highlighting on the rest of the document. Attribute names separated with tabs are recognized as well.

Verification

  • Regression on clean master — failed with the following line highlighted as identifier.
  • go test ./runtime -run TestXMLEmptyTagWithSpace -count=10 — passed.
  • go test ./... — passed.
  • go generate ./runtime — passed with no tracked output changes.
  • go build ./cmd/micro — passed.
  • git diff --check — passed.
  • go vet ./... — retains the existing unkeyed-literal and copied-lock warnings reproduced on clean master.
Before After
XML highlighting leaking after a spaced empty tag XML highlighting preserved after a spaced empty tag

Fixes #4213

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XML syntax highlighting breaks if empty tag contains whitespace before close

1 participant