Roald87 / TcBlack

Opnionated code formatter for TwinCAT.
MIT License
103 stars 11 forks source link

Auto upper standard data types #37

Closed kdorsel closed 4 years ago

kdorsel commented 4 years ago

Twincat will automatically capitalize types and keywords. This will do that for data types.

Roald87 commented 4 years ago

Thanks for the PR!

Doesn't TwinCAT automatically do this already? At least in my editor it already does this. See https://infosys.beckhoff.com/content/1033/tc3_plc_intro/9007201787974027.html?id=5455052691128461949 option Convert keywords to uppercase automatically (AutoFormat)

kdorsel commented 4 years ago

Yes, 99% of the time keywords are uppercase automatically. There are a few instances in which they do not though.

For example is you type up the variable type and then click into the body editor without changing lines in the variable definition it will stay lowercase. If the file is then saved it will never be uppercased automatically.

I understand it's rare, but I still think it's something that we should make sure of.

kdorsel commented 4 years ago

Complete rewrite of this upper function. Now includes variable definition as well as objects and uses a static class for better performance.

Took the keyword list from here and added missing data types. https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_plc_intro/2529971595.html&id=