Closed mateusz-matyjaszczyk closed 1 year ago
Hi,
This is interesting one.
I could add a VSCode preference entry with configurable id generation formula, because now there is id naming style linter. Default value for the preference entry would be e.g. id{MeaningAssumption}{Counter}{ControlName}
, so the formula should match with linters idNamingPattern
formula in order not to generate ids which will be not against the linter.
{Counter}
would be 0,1,2...n
and it would be inserted only if such id already exists in view/fragment.
Another thing to discuss would be if Element
s needs to have an id, or Control
s only?
E.g.
<Select>
<c:Item/>
</Select>
Select
is a Control
, and Item
is an Element
, and I don't think that Item
needs an id here.
I would also slight to the camp that Element doesn't need the id... nevertheless if you turn on flexEnabled on your project this is the error:
which would imply that Element actually do need an ID. Maybe it would be a good idea to have a preference entry -> "generateIdsForElements" as a boolean.
Hmm, okay, noted. Sounds doable. I will try to implement it in v1.11.0/v1.12.0
Done. Please check.
Works fine. Thanks!
Describe the feature As we know SAP have KeyUser adaptation which can be turned on for on-prem apps as well as apps deployed to Workzone. To get this feature to work correctly we do need unique IDs on all controls within the project. I would like to request a feature that can dynamically generate IDs for the controls that does not have IDs yet. It would be great if we can somehow describe the pattern on how to generate it but default one could be something like: id="idViewNameControlType_ConsequtiveNumber" -> i.e. for a button in mainView it would be then "idMainViewButton_1", second button would have "idMainViewButton_2"
Additional context There is not really much I can add to if. If you have any questions or ideas, hints if this is achievable currently please let me know