Comments (10)
It's the other way around: the right part (diagram) is generated from the left part (DSL text). The code for this transformation is here:
https://github.com/eclipse-sprotty/sprotty-vscode/blob/master/examples/states-langium/language-server/src/diagram-generator.ts
from sprotty.
so if i need to achieve my requirement #375 ,to tranform industrial Programming Language LD(Ladder Diagram) to other specific lauguage like C++ or PLC ST (Structured Text)language,LD is similar to right part,C++ or PLC ST (Structured Text)language is similar to left part,i am considering define .langium extesion file to generate left part code template ,or do i have to write left part code by myself
from sprotty.
Langium can be used to create a parser and a language server for your ST language. Serializing text from another format is also on the roadmap, but currently not supported. So you need to generate the text with normal JavaScript / TypeScript templates.
from sprotty.
Langium can be used to create a parser and a language server for your ST language. Serializing text from another format is also on the roadmap, but currently not supported. So you need to generate the text with normal JavaScript / TypeScript templates.
can not clealy catch your meaning ,what do you mean by saying "Serializing text from another format",Serializing text means ST language? is my requirements currently can not be achieved by sprotty and langium?
i am thinking use langium as language server,VS Code extensions as language client,vscode webview to render LD diagram,which receive VS Code extensions response,the response from language server via lsp protocol
from sprotty.
Yes you can use Sprotty and Langium for those things. The only step that is currently not done automatically is to generate ST text from a diagram, you would need to implement that yourself. Langium has nice APIs to generate text: https://www.typefox.io/blog/code-generation-for-langium-based-dsls
from sprotty.
Yes you can use Sprotty and Langium for those things. The only step that is currently not done automatically is to generate ST text from a diagram, you would need to implement that yourself. Langium has nice APIs to generate text: https://www.typefox.io/blog/code-generation-for-langium-based-dsls
i have seen laugium example like domainmodel or statemachine,also see sprotty document and example ,i probably knows how they works,take domainmodel as an example ,it firstly define a custom language with extension .domainmodel,then generate ast code by langium-cli,then use cli to generate java code with the help of generated ast code ,so if i need to achieve this requirement,i am thinking define a custom lauguage like extension .aaa,i write aaa.langium grammar related to LD language logic(#375 ) ,then generate ast code by langium-cli,then i write example.aaa ,corresponding diagram is generated by extends LangiumDiagramGenerator,then i use cli to generate ST code by using generated ast code,is my idea correct?
from sprotty.
the requirement is when right part changed,corresponding left part code is changed too,rather than left part changed,the right part is changed.
also,righr part is operated by user on diagram editor,like drage a component or add a component like picture below
finally,generate code is also needed a requirement( industrial Programming Language LD(Ladder Diagram) to other specific lauguage like C++ or PLC ST (Structured Text))
i was wondering whether sprotty-langium can achieve this requirements ,or should i use glsp instead
from sprotty.
LD is a graphical language. What format are you using to persist it? If it's a custom text language, you can use Langium to parse that and then generate other formats like ST or C++. But if you use XML or JSON, you don't need Langium; just use plain TypeScript or some template library in that case.
from sprotty.
when right part delete a component for example,i found corresponding left part also changed too,how their synchronized,i did not find related code
from sprotty.
The code is here: https://github.com/eclipse-sprotty/sprotty-vscode/blob/master/packages/sprotty-vscode-webview/src/lsp/editing/delete-with-workspace-edit.ts
from sprotty.
Related Issues (20)
- SCompartment question HOT 1
- Conflicting request IDs in client and server
- generator-sprotty is not part of the sprotty organization HOT 2
- Remove `SModelExtension` interface HOT 1
- Remove test-helper and jsdom dependency HOT 3
- Data Elements HOT 3
- Edge created while dragging from a port is deleted after any model change HOT 3
- Zoom in or out results in a bad scroll offset for the last handled WheelEvent HOT 1
- SVG export doesn't work when ProjectedViewport is used
- Fix versions of Sprotty dependencies HOT 1
- Enhance Sprotty JSX/TSX support HOT 2
- Junction point edge routing
- Self-contained SVG Export HOT 3
- ELK rectpacking causes error HOT 4
- Support shadow dom
- sprotty-elk sometimes doesn't delete old edge bends on layout changes HOT 4
- Moving multiple containers does not show feedback move of internal edge bendpoints
- Zoom limits are not optional
- DiagramServerProxy should forward all responses to server requests
- Polyline error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sprotty.