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

Common Editor Support for Syntax #254

Open
jhechtf opened this issue Aug 10, 2019 · 5 comments
Open

Common Editor Support for Syntax #254

jhechtf opened this issue Aug 10, 2019 · 5 comments

Comments

@jhechtf
Copy link

jhechtf commented Aug 10, 2019

So I went through the tutorial and while a lot of Moon is very JSX / React-like, there are certain things (like the <for> in Moon, which are very different. This can cause some strange issues in code editors that are unaware of the element.

If Moon is a serious development (which it appears to be) then creating some add-ons for syntax support for common editors (Sublime, VSCode, etc.) is likely a good idea. I did a search on the VSCode marketplace and didn't find anything. I've never personally build a syntax highlighter for VSCode yet, but I would be willing to look into how and perhaps start the project off.

@kbrsh
Copy link
Owner

kbrsh commented Aug 11, 2019

Yup, this is definitely on the roadmap. If you'd like to build a syntax highlighter then go for it! I'd recommend building one for whichever editor you personally use. Creating a TextMate grammar should extend nicely to most editors. You should be able to build on top of a JSX syntax highlighter. Some differences are:

  1. Moon elements require parenthesis around them.
  2. Property keys can be empty, so you can do <Component="foo"/> and the props would look like { "": "foo" }.
  3. Event handlers use @ as a prefix instead of on.

That's all I can name off of the top of my head, but that's the majority of the difference in regards to syntax.

@jhechtf
Copy link
Author

jhechtf commented Aug 11, 2019 via email

@kbrsh
Copy link
Owner

kbrsh commented Aug 11, 2019

There are no plans as of now to use TypeScript within Moon itself, and I may write types for the API — it's lower priority though. Right now I'm focusing on some official drivers, specifically the router and HTTP drivers.

@jhechtf
Copy link
Author

jhechtf commented Aug 12, 2019 via email

@kbrsh
Copy link
Owner

kbrsh commented Aug 12, 2019

Yup, type definitions might be added but aren't top priority for now.

If I get something I'll link it on this and submit a pull request to update the docs

That's awesome! Feel free to add it in the "View" section if you end up adding to the docs. If not, I'll be happy to write them as well.

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

No branches or pull requests

2 participants