mdx-analyzer icon indicating copy to clipboard operation
mdx-analyzer copied to clipboard

feat Support for highlighting JSX evaluated expressions

Open KeyboardSounds opened this issue 3 years ago • 3 comments

In JSX, you can include JS expressions within tags, like:

{doSomething(‘a’, 7)}

This PR adds syntax highlighting for those expressions.

Limitations

It will still highlight JS that isn’t valid to include in a JSX evaluated expression (eg. a class definition), which as far as I can tell is a limitation of how embedded languages work in TextMate syntax highlighting definitions.

KeyboardSounds avatar Aug 27 '22 02:08 KeyboardSounds

🦋 Changeset detected

Latest commit: a6316bf80b85a0386fa5fcda3402fff0e29acbcb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
vscode-mdx Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Aug 27 '22 02:08 changeset-bot[bot]

📊 Package size report   No changes

File Before After
Total (Includes all files) 29.7 kB 29.7 kB
Tarball size 12.4 kB 12.4 kB
Unchanged files
File Size
.changeset/config.json 312 B
.changeset/README.md 510 B
.commitlintrc 35 B
.editorconfig 161 B
.eslintignore 32 B
.eslintrc 191 B
.github/FUNDING.yml 234 B
.github/workflows/ci.yml 551 B
.github/workflows/pkg-size.yml 496 B
.github/workflows/publish.yml 1.2 kB
.github/workflows/release.yml 323 B
.github/workflows/version.yml 853 B
.lintstagedrc.js 46 B
.prettierrc 24 B
.remarkrc 42 B
.renovaterc 35 B
.simple-git-hooks.js 51 B
.vscode/launch.json 540 B
.vscodeignore 103 B
.yarnrc 20 B
assets/mdx.png 3.3 kB
CHANGELOG.md 3.9 kB
language-configuration.jsonc 1.1 kB
LICENSE 1.1 kB
package.json 4.6 kB
patches/eslint-mdx+2.0.2.patch 796 B
README.md 7.3 kB
syntaxes/mdx.tmLanguage.json 1.3 kB
test/component.js 54 B
test/fixture.mdx 423 B

🤖 This report was automatically generated by pkg-size-action

github-actions[bot] avatar Aug 27 '22 02:08 github-actions[bot]

In its current state, this PR fails linting:

yarn run v1.22.15
$ /workspaces/vscode-mdx-1/node_modules/.bin/lint-staged
✔ Preparing lint-staged...
❯ Running tasks for staged files...
  ❯ .lintstagedrc.js — 2 files
    ↓ *.{*sh,env,env.*,gql,ini,properties,rb,css,less,sass,scss,styl,stylus,svelte,vue} — no files [SKIPPED]
    ↓ .!(browserslistrc|nvm)rc — no files [SKIPPED]
    ↓ Dockerfile — no files [SKIPPED]
    ❯ *.{cjs,cts,js,json,jsonc,json5,jsx,html,md,mdx,mjs,mts,pug,svelte,toml,ts,tsx,vue,yaml,yml} — 2 files
      ✖ eslint --cache -f friendly --fix [FAILED]
↓ Skipped because of errors from tasks. [SKIPPED]
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...

✖ eslint --cache -f friendly --fix:


  ✘  http://eslint.org/docs/rules/

     Parsing error: Could not parse expression with acorn: Expecting Unicode escape sequence \uXXXX


     test/fixture.mdx:28:5
     26 | Lorem ipsum dolor sit _amet_, consectetur adipiscing elit. Ut ac lobortis velit.
     27 | 
   > 28 | {3 \* 7}
        |     ^
     29 | 

✘ 1 problem (1 error, 0 warnings)


Errors:
  1  http://eslint.org/docs/rules/null
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I could change the text case to avoid this, but that seems dodgy. Does anyone have any pointers on how to fix this? I’m a bit lost on how the linting config works for this repo.

KeyboardSounds avatar Aug 27 '22 02:08 KeyboardSounds

Your changes have been released in version 1.1.0. Thanks again! :heart:

remcohaszing avatar Jan 13 '23 15:01 remcohaszing