-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Auto upper standard data types #37
Conversation
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) |
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. |
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.
Can you
- Also make it pass the following tests:
[InlineData(
"METHOD Read : pointer to array[1..nNumber] of int ",
"METHOD Read : POINTER TO ARRAY[1..nNumber] OF INT"
)]
[InlineData(
"METHOD Read : String(nInt) ",
"METHOD Read : STRING(nInt)"
)]
- Merge the current merge conflict?
f1bf61c
to
2fee91b
Compare
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. |
@@ -179,7 +179,7 @@ private void AssertEquals(TcDeclaration expected, TcDeclaration actual) | |||
"deviceDown AT %QX0.2 : BOOL ; ", | |||
"deviceDown AT %QX0.2 : BOOL;" | |||
)] | |||
[InlineData("devSpeed:TIME:=T#10ms;", "devSpeed : TIME := T#10ms;")] | |||
[InlineData("devSpeed:TIME:=T#10ms;", "devSpeed : TIME := T#10MS;")] |
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.
Very unfortunate that TwinCAT auto capitalize, converts the time units to upper case. The one with small case units is much better to read, because of the size difference of numbers and small case letters in most fonts. Since TwinCAT does this, I guess we'll stick with this.
Twincat will automatically capitalize types and keywords. This will do that for data types.