Creating Syntax for MDX, end not working

Hey guys,

I’m trying to create a syntax for MDX. It’s somewhat adapted from the VS code one.

Here is the current setup:

patterns: [
    { include: "#markdown" }
    { include: "#jsx-module" }
    { include: "#jsx-tag" }
  ]
repository: {
  "jsx-module": {
    begin: "^(?=(import|export)\\b)",
    comment: "should match a component"
    end: "(\s*$)",
    contentName: "source.js.jsx",
    patterns: [
      {include: "source.js.jsx" }
    ]
  }
  "jsx-tag": {
    begin: "^(?=<([a-z]|[A-Z]))",
    end: ">",
    contentName: "source.js.jsx",
    patterns: [
      { include: "source.js.jsx" }
    ]
  }
  "markdown": {
    contentName: "source.gfm",
    patterns: [
      { include: "source.gfm" }
    ]
  }
},
scopeName: "source.markdown.jsx",
fileTypes: ["mdx"]

The issue i’m having is that after JSX, it wont revert to normal markdown unless there is a space after the closing tag: ie

<TestComponent /> <-- space here
## This stuff will work

<TestComponent /><-- no space
## This stays as JS sauce syntax

Even if I use the same end statement as the one for import / export (which is working fine)

It still doesn’t turn the js syntax off without a space. Given that the exact same end statement doesn’t work across two cases consistently, could it be a bug?