-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
feat: add @mermaid-js/parser
package and info
langium parser
#4727
feat: add @mermaid-js/parser
package and info
langium parser
#4727
Conversation
a18c0a7
to
bf6d957
Compare
e8620f6
to
d4945b4
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #4727 +/- ##
==========================================
+ Coverage 45.36% 46.58% +1.22%
==========================================
Files 52 55 +3
Lines 6649 6818 +169
Branches 32 36 +4
==========================================
+ Hits 3016 3176 +160
- Misses 3632 3641 +9
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
e567deb
to
b77a4fe
Compare
|
I didn't use |
Changing the base branch so only relevant changes are visible. |
@Yokozuna59 can you provide a highlevel diagram/explanation of how everything works? |
@sidharthv96 It would take time, but sure. But I don't |
parse.patch // packages/mermaid/src/diagrams/info/infoParser.ts
import { parse, Info } from 'mermaid-parser';
import { log } from '../../logger.js';
import { ParserDefinition } from '../../diagram-api/types.js';
export const parser: ParserDefinition = {
parse: (input: string): void => {
const result = parse<Info>('info', input);
log.debug({ result });
},
}; I feel like we could even remove this parser file entirely, as it's generic. It could be replaced with a processor, that traverses the AST and populates the DB. Does langium have support for something like https://chevrotain.io/docs/tutorial/step3a_adding_actions_visitor.html#visitor-methods ? Maybe the returned object itself is processed this, I'm not sure. |
@sidharthv96 I think I've resolved somehow, I took some inspiration from code. eb463f7 Note: I didn't modify
The current mermaid/packages/parser/src/language/common/common.langium Lines 1 to 5 in eb463f7
I don't know tbh. |
|
|
@msujew What about syntax highlighting and railroad? Do we have to generate and export them in |
@Yokozuna59 I'm not sure I would export anything of that at all. Ideally, you would write your own syntactical highlighting file for vscode, since the generated one is very simplistic and not designed to be used in production. Why would you want to export the railroad diagram? It's for development/documentation purposes and doesn't serve any runtime value. |
@msujew My main idea is to use it as a base, then modify according to each use case. I don't think we should figure out how to support each change in grammar manually, we could use the ones generated by |
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@Yokozuna59 can you sync with Requesting final reviews from @knsv @aloisklink @nirname @mermaid-js/atlantians |
It's synced with
There aren't any issues as far as I know, but some attributes in the package aren't exported that are essential for the language server. |
Did I see a comment that the netlify stuff is broken, and that is "OK" for now? |
@jgreywolf I don't think it would bother us right now. |
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.
Everything looks great to me, with one exception!
the netlilfy workflows are failing because of eslint out of memory
If netlilfy is failing, that's pretty major! (sorry, @Yokozuna59, I know this isn't your fault!)
Can we somehow let netlilfy use more memory? gatsbyjs/gatsby#15190 (comment) seems to suggest we can just add the following to our netlify.toml
file:
[build.environment]
# prevent out-of-memory error when building
NODE_OPTIONS = "--max_old_space_size=4096"
"name": "mermaid-parser", | ||
"version": "0.2.0", |
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.
I'll publish it to the org before merging. Then you can deprecate the old one.
Sounds good! Remember to also update the mermaid-parser
links in the README.md!
* next: chore: Increase heap size when building fix(er): bug if relationship is declared first test(er): add cypress test on entity name alias feat(er): use square brackets to add aliases docs(er): add release version for entity name aliases feat(er): add entity name alias
Netlify should be fixed now. |
Congratulations @Yokozuna59 ! You really pushed this through, we've been considering replacing JISON for a looong time, without actually doing it. Massive thanks to @msujew and langium team for the support! |
@sidharthv96 Thanks! Many thanks to @msujew and the Langium team for the massive support and fast response; I wouldn't have made it without them :) I've some questions:
|
📑 Summary
parser
package insidepackages/parser
.info
langium parser and integrate it inpackages/mermaid
.title
,accTitle
, andaccDesrc
toinfo
grammar.info
grammarBenchmark (Vitest)
JISON commit: 99978da
Langium commit: 6fa8294 (langium has more possible hidden rules and attributes)
BREAKING CHANGES
showInfo
frominfoDb
.Issues
langium
instead ofjison
#4401📏 Design Decisions
How langium parser works?
📋 Tasks
Make sure you