Serhioromano / vscode-st

Extension for VS Code to support Structured Text language.
https://marketplace.visualstudio.com/items?itemName=Serhioromano.vscode-st#overview
MIT License
141 stars 28 forks source link

VAR/END_VAR scope when as parts of other identifiers #31

Closed msftrncs closed 3 years ago

msftrncs commented 3 years ago

VAR and END_VAR incorrectly scope when run in to other identifiers in certain orders

image

VAR does not validate word break at end, END_VAR does not validate work break at either end.

VAR_x seem to be same as VAR

Looks like the \b is missing from the end of both the begin and end clauses.

Serhioromano commented 3 years ago

If you put all in one line not sure it is fixable. Scope is defined with JSON file, and basically as I understand it, VS Code takes care of scopes, open\close brackets.

msftrncs commented 3 years ago

https://github.com/Serhioromano/vscode-st/blob/f33afa298c99bbc60bc3b11f04945ef32df050f4/syntaxes/st.tmLanguage.json#L220-L226

"begin": "\\b(?:VAR(?:_(?:INPUT|OUTPUT|IN_OUT|TEMP|GLOBAL|ACCESS|EXTERNAL))?|STRUCT|UNION|PUBLIC|PRIVATE|PROTECTED)\\b", 
"end": "\\b(?:END_(?:VAR|STRUCT|UNION))\\b",

(different coloring here, but now the keywords run together are no longer 'keywords') image

Serhioromano commented 3 years ago

(different coloring here, but now the keywords run together are no longer 'keywords') image

Is that how it supposed to behave? Looks correct to me. You can PR this change.

msftrncs commented 3 years ago

After Appling correction:

image