mdx-js/mdx-analyzer

JS Fenced code block breaks highlighting when indented

XiNiHa opened this issue · 7 comments

Initial checklist

Affected packages and versions

vscode-mdx@1.8.2

Link to runnable example

No response

Steps to reproduce

Open an MDX file in VSCode, write this:

<Comp>
```js
console.log(0);
```
</Comp>

<Comp>
  ```ts
  console.log(0);
  ```
</Comp>

<Comp>
  ```js
  console.log(0);
  ```
</Comp>

Expected behavior

All should be highlighted correctly.

Actual behavior

The first two works correctly. But the last one breaks and continues to pretend like JS even after the fence.

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

I don’t understand what you mean. This is what I’m seeing:

The provided code snippet in Visual Studio Code

Is this somehow incorrect? Are you seeing something else? Can you provide a screenshot?

That's weird, I'm seeing this
image

Oh well, it was a wrong interaction with Babel JavaScript extension. Removing the extension fixed it.

Does it also cause this issue for JavaScript in HTML / Astro / Vue?

image
image

Looks like the issue also applies to them, maybe it's a Volar issue then?

Volar doesn’t handle syntax highlighting. That’s handled by TextMate grammars. It’s not something I’m super familiar with, but it looks like the Babel JavaScript extension doesn’t properly close a particular scope. It’s a bug in that extension, not here.

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.