-
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
Use exact project name for code generation #1122
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.
I propose changing this to always use the exact project name, and terminate with an error during initial validation if the project name is not a valid identifier.
Actually we're already making this conversion in the Yeoman generator:
👍. You mean an error from yeoman generator or langium cli? const languageName = _.upperFirst(
_.camelCase(this.answers.rawLanguageName)
);
const languageId = _.kebabCase(this.answers.rawLanguageName); I propose to never do case conversions like these, as it makes users lose control of the final result. We can prompt user to request names on different cases (maybe with suggested value) in project generation. It's obviously a breaking change, maybe can be shipped with v2.0.0? |
@jindong-zhannng What Miro meant is that the CLI should accept every name accept for those that are not valid identifiers in TypeScript. For example, a Projectname |
Interesting, that didn't happen to me for a while. Sometimes GitHub has troubles with rebases and simply deletes the branch. Please create a new PR 👍 |
@msujew That because I did some change 😂. Now I remove the case conversion behavior and add a regex to validate project name. |
@jindong-zhannng that's perfect! But your change revealed that the |
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.
Thank you!
The default case type conversion rule don't always make sense for abbreviated project names. For example:
Then generated codes will be like
FormMlAstType
. But the expectation may beFormMLAstType
to keep abbreviations in uppercase.So I add an option
exact
to indicate that don't do any change on project name in generation.