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

Create a separate lfd CLI tool for generating diagrams from LF programs #897

Closed
lhstrh opened this issue Jan 27, 2022 · 2 comments · Fixed by #1713
Closed

Create a separate lfd CLI tool for generating diagrams from LF programs #897

lhstrh opened this issue Jan 27, 2022 · 2 comments · Fixed by #1713
Assignees
Labels
cli feature New feature good first issue Good for newcomers
Milestone

Comments

@lhstrh
Copy link
Member

lhstrh commented Jan 27, 2022

In order to avoid bloating lfc, diagram synthesis features should be made available using a separate CLI tool.

An easy first step would be to generate an SVG, but it might also be possible to spawn a web interface that allows interactions with the diagram in a way similar to how the VS Code does this.

One advantage of having this capability would be that we'd be able to do some primitive testing of the diagram package as part of CI.

@cmnrd
Copy link
Collaborator

cmnrd commented Jan 27, 2022

Also see the discussion in #398.

Implementing this should make it easy to implement testing for diagrams (#802).

@cmnrd cmnrd added this to the 0.2.0 milestone Jan 27, 2022
@lhstrh
Copy link
Member Author

lhstrh commented May 27, 2022

@a-sr wrote:

As suggested here (#398 (comment)), you can use the language server for that (since it already handles all the build weirdness). All you need is an alternative main entry class that can be used to synthesized the diagrams instead of starting a language server.
We have one in Kieler (https://github.com/kieler/semantics/blob/master/plugins/de.cau.cs.kieler.kicool.ide/src/de/cau/cs/kieler/kicool/ide/cli/KielerCompilerDiagramCLI.xtend) but it has a lot of additional functionality such as setting synthesis options (normally check boxes in the sidebar).
For a minimal prototype, the important steps are calling KlighdStandaloneSetup.initialize() and exporting the diagram with LightDiagramServices.renderOffScreen(model, format, target.path, properties). The model needs to be parsed with Xtext beforehand but I guess you already know how to do that for lfc.

Then you should be able to use the LS jar as an exporter. The only thing you have to make sure is specifying the correct entry class and put the correct platform-dependent SWT library on the class path (same as for the LS startup in VSC: https://github.com/lf-lang/vscode-lingua-franca/blob/add4b3bf15771e4096285b8043bf237ec88a2958/src/extension.ts#L37).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli feature New feature good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants