Skip to content

Commit 46510cd

Browse files
committed
add surround features
1 parent 693d7f6 commit 46510cd

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
@@ -51,6 +51,17 @@ LessThan(expected := 0, actual := 0);
5151
GreaterThan(expected := 0, actual := 0);
5252
```
5353

54+
## Surround with
55+
56+
![surround](doc/img/surround.gif)
57+
58+
Available surround with:
59+
60+
- FOR ... END_FOR;
61+
- IF ... THEN ... ELSE
62+
- WHILE ... END_WHILE
63+
- REPEAT .. END_REPEAT
64+
5465
## Snippets Namespace Support
5566

5667
### NamespaceSupport
@@ -180,6 +191,15 @@ Output example:
180191

181192
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.
182193

194+
### Markdownlint-cli
195+
196+
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.
197+
To avoid, that the CI workflow fails because of the markdown linter, you can check all markdown files locally by running the markdownlint with:
198+
199+
```sh
200+
markdownlint **/*.md --fix
201+
```
202+
183203
## License and Legal information
184204

185205
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)