-
Notifications
You must be signed in to change notification settings - Fork 68
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
Split grammar and main export #1171
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.
Thanks! A few questions, maybe we can discuss them in today's dev meeting:
- Why did you move so many functions from
internal-grammar-util
togrammar-util
? - How can we guarantee that we don't accidentally introduce unwanted dependencies to grammar code in the core framework?
- Many files use
grammar/generated/ast
– maybe we should move that out of thegrammar
folder or reexport them ast-reflection-interpreter
uses more grammar internal code, but is in thelanguage
foldervalue-converter
still uses a function frominternal-grammar-util
- Many files use
0cc0ee1
to
fcbc1a6
Compare
The
I would tackle this in another PR. The PR is large enough as it is. |
@msujew we are currently using |
b2a7d27
to
9d6a154
Compare
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 know we've talked about including this change in the 2.x version stream, but now it looks like a too big breaking change to me. One option could be to plan for a 3.0.0 version rather soon so we don't have to worry too much about the changes?
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.
The changes look good to me. I would only suggest to modify the main package export test so it excludes the grammar code (see #1269).
I also thought about generating the grammar related files into different folders, specifically to move the AST file to src/language/grammar-ast.ts
. This would make code isolation much easier, but we would need a special case for langium-cli (which we already have with the langiumInternal
flag). WDYT?
9d6a154
to
fbf06f6
Compare
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.
Looks very good to me 👍, I have only one remark on the duality of grammar
vs. language
about making clear its rationale. IMO the name language
is too ambiguous here, what about languages
or language-api
. Or even grammar-api
as it describes the API to implement evaluations of grammars.
I assume you have tested that this cut get's us the expected reduction in bundle size 😉
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.
As I already said, some hints in the index files of languages
and grammar
on their purpose would be nice for others to understand their purpose.
Apart from that 🚀
Closes #1167
Bundle size benchmark on the arithmetics example:
We can see that we remove roughly ~175kb from a minified language server bundle with this change, reducing small language server bundles by 28%.