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
chore: add attributes to cem #8405
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 fine by me, let's merge tomorrow after the 1.23.1 release
I have run Thank you |
@nnaydenow Are you sure with the types? The old generator crated the attributes like this: {
"default": "\"Default\"",
"deprecated": false,
"readonly": "false",
"fieldName": "design",
"name": "design",
"type": {
"text": "sap.ui.webc.main.types.IconDesign"
},
"description": "Defines the component semantic design."
}, The current one will produce this : {
"description": "Defines the component semantic design.",
"name": "design",
"default": "\"Default\"",
"fieldName": "design",
"type": {
"text": "\"Neutral\" | \"Information\" | \"Positive\" | \"Negative\" | \"Critical\" | \"Default\" | \"Contrast\" | \"NonInteractive\""
}
}, For the web-types.json the type definition like this is fine, because you get code completion. I am not sure , if writing the type like it is written in the member, would be more correct. "type": {
"text": "IconDesign",
"references": [
{
"name": "IconDesign",
"package": "@ui5/webcomponents",
"module": "dist/types/IconDesign.js"
}
]
}, But at the end of the day the attributes are always strings in html, the notation you used is more useful. BTW: All my generator pipelines are working fine with your version. |
Hi @veith, I've made it with this idea. Class field are described with TypeScript type and reference to it but for attributes I'm resolving the type to the values that attribute will accept to achieve the code completion suggestions. I'm using VS Code and it doesn't understand these descriptors if they have references so that's the reason why I though it would be better if the attributes values are the enums values resolved to strings. |
I tried it in WebStorm, having the possible values as code completion is a huge improvement. Thank you again. |
Co-authored-by: Nayden Naydenov <nnaydenow.work@sap.com>
Fill attributes array with properties that have attribute representation for custom elements. In addition provide
vscode.html-custom-data.json
andweb-types.json
for better integration with IDEs.Usage:
web-types.json
exist.vscode/settings.json
is adjusted for improve development in ui5-webcomponents packages (you need to build the project for autocompletion).vscode/settings.json
on your own and to add:Fixes: #8392