-
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
Perform parser optimizations in production mode #1688
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.
Looks good, but as I understand, this needs to be explicitly configured in langium-config.json
, right?
Perhaps it is possible to add a default value in loadConfig
like so?
config.mode ??= process.env.NODE_ENV ?? 'development';
Such that warnings would be present in dev mode (running with npm run langium:watch
), but not in the production build
@aabounegm Thanks for taking a look!
You can also use the |
Ok that makes sense, I wasn't aware of the CLI option. In that case, maybe there should be an explicit |
There already is: langium/packages/langium/package.json Line 62 in 335f9a9
It's invoked before publishing the Langium artifacts. |
76250a8
to
5547dab
Compare
5547dab
to
0fd4151
Compare
Sorry, I meant in the template so that new projects would make use of it |
How would we handle this when we publish the npm packages and vscode extension? Shall we re-generate the grammar language with production mode before publishing? |
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.
Oh I see, that's what we already do:
langium/.github/workflows/publish.yml
Line 28 in 335f9a9
npm run langium:generate:production --workspace=langium |
It's a bit strange to change a generated file that is also in version control during the release process, but this is likely the most pragmatic solution for now.
@msujew will there a preview/alpha available for this feature |
@cdietrich I can release one after tomorrow's dev meeting. I'll let you know. |
Closes #1687
Improves the
production
mode setting for the langium CLI. It's now generated into the language meta data and is used to skip validations and ignore ambiguity issues in the parser if activated.This should improve the startup time of all grammars and is quite noticeable on larger grammars.