question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[html] HTML breadcrumbs don't work right when optional end tags omitted

See original GitHub issue
  • VSCode Version: 1.42.0-insider
  • OS Version: Linux Mint 19.3

Steps to Reproduce:

  1. Create an HTML document. Sprinkle liberally with <p>, <li> (inside of <ul> or <ol>, obviously), <tr> or <td> inside of <table>, and any other elements noted in the HTML5 spec as having optional end tags (see https://html.spec.whatwg.org/#syntax-tag-omission).
  2. If you closed the various tags above with their end tags (e.g., </p>), then run the page through something like HTML Tidy (I am using v5.7.28), passing in the --omit-optional-tags yes argument.
  3. Open the reformatted file in VSCode and navigate somewhere where there are multiple <p> or <li> or similar in a row. Note that there will be a breadcrumb for each open tag, because VSCode is apparently looking for end tags to close off the element, even though it is not required.

In a complex document, this make VSCode breadcrumbs pretty worthless. Here is an example, before a Tidy reformat, with focus on the third list item element in the fourth paragraph (note breadcrumbs working as expected):

BeforeReformat

And here are the breadcrumbs after the Tidy reformat, with focus on the same list item element:

AfterReformat

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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
bitwisemancommented, Apr 6, 2020

v1.11.0 of js-beautify fixes the formatting issue that @nikeee commented on. This doesn’t fix the breadcrumb issue.

0reactions
aeschlicommented, Jan 5, 2021

Related issue in https://github.com/microsoft/vscode-html-languageservice/issues/63

@bitwiseman Sorry for only see your question now. Yes, that needs to go into the HTML parser. If you want to give it a try, that would be fantastic.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Omitting optional tags of html - Stack Overflow
If you use HTML 4 transitional, then yes, you're fine leaving off end tags. If you use XHTML or HTML 4 strict, then...
Read more >
Handling common HTML and CSS problems - MDN Web Docs
Some problems can be solved by just taking advantage of the natural way in which HTML/CSS work. Unrecognized HTML elements are treated by...
Read more >
Restrict filters and breadcrumbs with fixed queries
You can use a script to restrict filters and breadcrumbs to specific roles, either on a per-table or global basis. Using a script...
Read more >
WordPress Breadcrumbs: How to Enable Them on Your ...
On the left side, right below the header, you can see the words Home > Resource Center > Kinsta Blog. Each is a...
Read more >
Optional closing tags in HTML - tempertemper
There's a relatively short list of elements you can do this with. So you could come a cropper by omitting the closing tag...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found