Language-tools: Syntax highlight incorrect when preceding component is self-closing

Created on 18 Jan 2021  ·  3Comments  ·  Source: sveltejs/language-tools

The syntax highlighting is incorrect when the preceding component is self-closing. (See screenshot below.)

You can copy the following code into a *.svelte file to see:

<SelfClosingComponent/>
<div>stuff</div> <!-- highlight problem with opening tag -->
<div>stuff</div> <!-- no highlight problem -->

<SelfClosingComponent/>
<meta/> <!-- highlight problem -->

<SelfClosingComponent/>
<div/> <!-- highlight problem, but also not valid html, so...??? -->

<SelfClosingComponent/>
<!-- <Intro/> --> <!-- highlight problem -->
<!-- <Intro/> --> <!-- returns to normal after problem -->

<SelfClosingComponent></SelfClosingComponent>
<div>stuff</div> <!-- no highlight problem when component has ending tag -->

Expected behavior
Highlight should return to normal behavior following self-closing components such as <SelfClosingComponent/>.

Screenshot
image

System (please complete the following information):

  • OS: MacOS Catalina v10.15.3
  • IDE: VSCode v1.52.1 Commit ea3859d4ba2f3e577a159bc91e3074c5d85c0523
  • Plugin/Package: Svelte for VSCode
Fixed bug

All 3 comments

A simpler example

<div/>
<div></div>

Code_2021-01-22_18-04-16

It only happens if there is no space before the closing part
Code_2021-01-22_18-05-01

Woo hoo! Thanks @dummdidumm!

Was this page helpful?
0 / 5 - 0 ratings