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

Auto-generating the grammar based on installed languages #9

Open
HoldYourWaffle opened this issue Aug 30, 2019 · 2 comments
Open

Auto-generating the grammar based on installed languages #9

HoldYourWaffle opened this issue Aug 30, 2019 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@HoldYourWaffle
Copy link

Would it be possible to auto-generate the "injection grammar" on startup based on the languages installed?
I'm asking because I'd love to use this for a custom DSL I made to make the parser tests more readable. Because I'm the only one that uses it I feel like adding it to this repository wouldn't make sense.

I'm sorry if this is a stupid question, I barely know enough about VS Code extension development to create the syntax highlighting for my DSL.

@mjbvz
Copy link
Owner

mjbvz commented Aug 30, 2019

Probably. See what vetur's vetur.generateGrammar command does for example: https://github.com/vuejs/vetur/blob/f2c73f783bc8636f11d894cbe4ec684aff07dd52/package.json#L69

PRs welcome

@mjbvz mjbvz added the help wanted Extra attention is needed label Aug 30, 2019
@HoldYourWaffle
Copy link
Author

That looks very interesting, I might try to take a short at this myself if I can find the time.

If I understand correctly, it provides the vetur.grammar.customBlocks configuration option where users can provide their own 'language mappings'. When the vetur.generateGrammar command is run it directly modifies its own grammar file, adding the custom 'injections'.
Is that accurate? Sorry, I'm just a total noob when it comes to vs code development.

If that's indeed what's happening: what happens when you update the extension, does the grammar file get overriden? If that's the case, is it possible to run the generation command automatically post-install?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants