Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML syntax highlighting is incorrect #140360

Closed
Bluebie opened this issue Jan 9, 2022 · 3 comments
Closed

HTML syntax highlighting is incorrect #140360

Bluebie opened this issue Jan 9, 2022 · 3 comments
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@Bluebie
Copy link

Bluebie commented Jan 9, 2022

Issue Type: Bug

if you enter in:

<a href=https://example.org/>foo</a> in a html highlighted document, the final / in the href attribute value is highlighted in a grey colour, as if is a self closing xml tag. I believe this behaviour is deceptive, it gives the wrong impression that a html parser would understand the code in this way, but the parsed value of the tag's href attribute is indeed "https://example.org/", which is true in Chromium and in the HTML5 spec.

VS Code version: Code 1.63.2 (Universal) (899d46d, 2021-12-15T09:37:28.172Z)
OS version: Darwin arm64 21.2.0
Restricted Mode: No

System Info
Item Value
CPUs Apple M1 (8 x 24)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 5, 4, 3
Memory (System) 8.00GB (0.11GB free)
Process Argv --crash-reporter-id 853ff5a3-ca88-48f7-846c-f5ed1cf44a91
Screen Reader no
VM 0%
Extensions (18)
Extension Author (truncated) Version
cddl-languageserver anw 0.1.3
better-toml bun 0.3.2
vscode-standardjs-snippets cap 0.8.15
vscode-standardjs che 1.4.1
vscode-eslint dba 2.2.2
vs-code-xml-format fab 0.1.5
auto-dark-mode Lin 0.1.7
vscode-docker ms- 1.18.0
remote-ssh ms- 0.70.0
remote-ssh-edit ms- 0.70.0
cpptools ms- 1.7.1
nodejs-docs Muk 0.2.2
vscode-hexdump sle 1.8.1
es6-mocha-snippets spo 0.2.2
svelte-vscode sve 105.8.0
vscodeintellicode Vis 1.2.15
five-server yan 0.1.2
city-lights-icon-vsc Yum 1.1.3

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
pythontb:30283811
pythonvspyt551cf:30345471
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30384386
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vscop804:30404766
vscop341:30404997
vsrem710:30416614
vscexrecpromp3t1:30407762

@gjsjohnmurray
Copy link
Contributor

The attribute value needs to be enclosed in quotes.

@Bluebie
Copy link
Author

Bluebie commented Jan 9, 2022

The attribute value needs to be enclosed in quotes.

No, they don't. Quotes around attribute values that do not contain whitespace or =, >, ", ', ` are redundant when it comes to parsing html documents.

https://html.spec.whatwg.org/multipage/parsing.html#attribute-value-(unquoted)-state

It should not be the responsibility of the syntax highlighter to impose opinion on what constitutes good or bad HTML. That should be the responsibility of linters.

@alexr00
Copy link
Member

alexr00 commented Feb 4, 2022

Thank you for the issue and the spec reference! I have opened an issue in the upstream repository that we get our html syntax highlighting grammar from: textmate/html.tmbundle#118

@alexr00 alexr00 closed this as completed Feb 4, 2022
@alexr00 alexr00 added grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream labels Feb 4, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

4 participants