Skip to content

Commit b43ea1f

Browse files
authored
Merge pull request #17 from simatic-ax/add_Sourround
add surround features
2 parents 29b6c61 + 46510cd commit b43ea1f

File tree

4 files changed

+88
-0
lines changed

4 files changed

+88
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ LessThan(expected := 0, actual := 0);
5858
GreaterThan(expected := 0, actual := 0);
5959
```
6060

61+
## Surround with
62+
63+
![surround](doc/img/surround.gif)
64+
65+
Available surround with:
66+
67+
- FOR ... END_FOR;
68+
- IF ... THEN ... ELSE
69+
- WHILE ... END_WHILE
70+
- REPEAT .. END_REPEAT
71+
6172
## Snippets Namespace Support
6273

6374
### NamespaceSupport
@@ -187,6 +198,15 @@ Output example:
187198

188199
Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section or, even better, is free to propose any changes to this repository using Merge Requests.
189200

201+
### Markdownlint-cli
202+
203+
This workspace will be checked by the [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli) (there is also documented ho to install the tool) tool in the CI workflow automatically.
204+
To avoid, that the CI workflow fails because of the markdown linter, you can check all markdown files locally by running the markdownlint with:
205+
206+
```sh
207+
markdownlint **/*.md --fix
208+
```
209+
190210
## License and Legal information
191211

192212
Please read the [Legal information](LICENSE.md)

doc/img/surround.gif

51.5 KB
Loading

snippets/stSurroundWith.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"surround_if_else": {
3+
"scope": "st",
4+
"prefix": [
5+
"surround with if-else..."
6+
],
7+
"body": [
8+
"IF (${1:condition}) THEN",
9+
"\t${TM_SELECTED_TEXT}",
10+
"END_IF;"
11+
],
12+
"description": "Surround selected text with if-else"
13+
},
14+
"surround_for": {
15+
"scope": "st",
16+
"prefix": [
17+
"surround with for-loop..."
18+
],
19+
"body": [
20+
"FOR Index := ${1:StartValue} TO ${2:EndValue} DO",
21+
"\t${TM_SELECTED_TEXT}",
22+
"END_FOR;"
23+
],
24+
"description": "Surround selected text with for-loop"
25+
},
26+
"surround_while": {
27+
"scope": "st",
28+
"prefix": [
29+
"surround with while..."
30+
],
31+
"body": [
32+
"WHILE (${1:condition})",
33+
"\t${TM_SELECTED_TEXT}",
34+
"END_WHILE;"
35+
],
36+
"description": "Surround selected text with while"
37+
},
38+
"surround_repeat": {
39+
"scope": "st",
40+
"prefix": [
41+
"surround with repeat..."
42+
],
43+
"body": [
44+
"REPEAT",
45+
"\t${TM_SELECTED_TEXT}",
46+
"\tUNTIL (${1:condition})",
47+
"END_REPEAT;"
48+
],
49+
"description": "Surround selected text with repeat"
50+
}
51+
}

src/testSurround.st

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
NAMESPACE Simatic.Ax
2+
CLASS testSurround
3+
VAR PUBLIC
4+
b : BOOL;
5+
END_VAR
6+
VAR PROTECTED
7+
8+
END_VAR
9+
10+
METHOD PUBLIC MyMethod
11+
REPEAT
12+
b := FALSE;
13+
UNTIL (condition)
14+
END_REPEAT;
15+
END_METHOD
16+
END_CLASS
17+
END_NAMESPACE

0 commit comments

Comments
 (0)