Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(playground): monaco jsx/tsc highlight #500

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

enzonotario
Copy link
Collaborator

@enzonotario enzonotario commented Sep 30, 2024

Related #158

It's not working yet, but I submit this to see if we can iterate over this to get it working.

In fact, I've found very hard to setup JSX/TSX highlighting in Monaco. I see it's a common issue over Internet. I tried:

This PR has a first try for monaco-jsx-syntax-highlight, with no success for now. Any help/guidance will be welcomed.

@aralroca
Copy link
Collaborator

Don't worry about the GH action tests, I see that oven-sh/setup-bun is down... 😅

Thanks for everything! I'll look at it later and give it a try. Good research and let's see if we get it with monaco-jsx-syntax-highlight. I tried in the past to add the lib dependencies to make it type-safe, but it didn't work either:

https://github.com/brisa-build/brisa/blob/084c3fa436d5b73e9bf41de796655213c63e99a3/packages/www/src/helpers/monaco-extra-libs/index.ts

@aralroca
Copy link
Collaborator

@enzonotario What does Monaco Editor offer to implement the highlight? What I don't like about monaco-jsx-syntax-highlight is that it uses Babel, currently we are already loading our parser, it would be better to use the same one, although it would take more time. Surely it is better to use this one for now, I understand that we need to add @babel/parser @babel/traverse to make it work well.

@aralroca
Copy link
Collaborator

Okay, PandaCSS does not use Babel and uses this library... I got confused by the official documentation of the library https://www.npmjs.com/package/monaco-jsx-highlighter

@enzonotario
Copy link
Collaborator Author

mm I tried with monaco-jsx-syntax-highlight
, not monaco-jsx-highlighter.. similar but different libraries..

and yes, I didn't tried monaco-jsx-highlighter because the Babel requirement

@aralroca
Copy link
Collaborator

mm I tried with monaco-jsx-syntax-highlight , not monaco-jsx-highlighter.. similar but different libraries..

and yes, I didn't tried monaco-jsx-highlighter because the Babel requirement

ok, now I understand the confusion! thanks

@aralroca
Copy link
Collaborator

aralroca commented Sep 30, 2024

@enzonotario is working, I think is missing only the CSS...!!!
Screenshot 2024-09-30 at 23 59 48

Here are the styles of PandaCSS as example: https://github.com/chakra-ui/panda/blob/503c065cd302845f691b15e578aaa659e7b02c6a/playground/src/components/Editor.tsx#L143

@aralroca aralroca marked this pull request as ready for review September 30, 2024 22:06
@aralroca
Copy link
Collaborator

I'll merge it and add the CSS, good job.

@aralroca aralroca merged commit 4008c3d into main Sep 30, 2024
0 of 6 checks passed
@aralroca aralroca deleted the feature/playground-highlight branch September 30, 2024 22:07
@enzonotario
Copy link
Collaborator Author

Ups, nice, thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants