-
Notifications
You must be signed in to change notification settings - Fork 66
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
Generate syntax railroad diagrams #1075
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great new feature! I also like how it's realized with relatively little code.
@msujew could you also add a description of the new webview feature to the extension README (and update it while you're at it)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool! I tried it out on a few of our example languages, and it works quite nicely. Just one suggestion below regarding terminals.
ee52a5c
to
511bf7f
Compare
I think it would be a visual improvement if would choose the same background color as we use for the diagrams. Or make the diagrams transparent, but that would conflict with dark/light mode (lines are black and will not be visible in dark mode). |
I think that we can leave those for later :) This PR does what it should, any additional changes can be performed on top. |
The decision might be already made, but my first try to use the railroads was through the Langium CLI. I was a bit surprised that there is no |
51dcb03
to
d856958
Compare
I think a Having a better |
Closes #827
Closes #1062
This change introduces a new package,
langium-railroad
that is able to generate railroad syntax diagrams from Langium grammars. The package is reused inlangium-cli
andlangium-vscode
:The vscode webview follows the current editor and updates on changes to the grammar file.
The new
langium-railroad
package can also be used in the playground for an inline syntax diagram view of the current grammar.