diff --git a/README.md b/README.md index de1ddaa..c445dab 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,17 @@ LessThan(expected := 0, actual := 0); GreaterThan(expected := 0, actual := 0); ``` +## Surround with + +![surround](doc/img/surround.gif) + +Available surround with: + +- FOR ... END_FOR; +- IF ... THEN ... ELSE +- WHILE ... END_WHILE +- REPEAT .. END_REPEAT + ## Snippets Namespace Support ### NamespaceSupport @@ -180,6 +191,15 @@ Output example: 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. +### Markdownlint-cli + +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. +To avoid, that the CI workflow fails because of the markdown linter, you can check all markdown files locally by running the markdownlint with: + +```sh +markdownlint **/*.md --fix +``` + ## License and Legal information Please read the [Legal information](LICENSE.md) diff --git a/doc/img/surround.gif b/doc/img/surround.gif new file mode 100644 index 0000000..bb49f4f Binary files /dev/null and b/doc/img/surround.gif differ diff --git a/snippets/stSurroundWith.json b/snippets/stSurroundWith.json new file mode 100644 index 0000000..a6eed47 --- /dev/null +++ b/snippets/stSurroundWith.json @@ -0,0 +1,51 @@ +{ + "surround_if_else": { + "scope": "st", + "prefix": [ + "surround with if-else..." + ], + "body": [ + "IF (${1:condition}) THEN", + "\t${TM_SELECTED_TEXT}", + "END_IF;" + ], + "description": "Surround selected text with if-else" + }, + "surround_for": { + "scope": "st", + "prefix": [ + "surround with for-loop..." + ], + "body": [ + "FOR Index := ${1:StartValue} TO ${2:EndValue} DO", + "\t${TM_SELECTED_TEXT}", + "END_FOR;" + ], + "description": "Surround selected text with for-loop" + }, + "surround_while": { + "scope": "st", + "prefix": [ + "surround with while..." + ], + "body": [ + "WHILE (${1:condition})", + "\t${TM_SELECTED_TEXT}", + "END_WHILE;" + ], + "description": "Surround selected text with while" + }, + "surround_repeat": { + "scope": "st", + "prefix": [ + "surround with repeat..." + ], + "body": [ + "REPEAT", + "\t${TM_SELECTED_TEXT}", + "\tUNTIL (${1:condition})", + "END_REPEAT;" + ], + "description": "Surround selected text with repeat" + } +} diff --git a/src/testSurround.st b/src/testSurround.st new file mode 100644 index 0000000..a03f02f --- /dev/null +++ b/src/testSurround.st @@ -0,0 +1,17 @@ +NAMESPACE Simatic.Ax + CLASS testSurround + VAR PUBLIC + b : BOOL; + END_VAR + VAR PROTECTED + + END_VAR + + METHOD PUBLIC MyMethod + REPEAT + b := FALSE; + UNTIL (condition) + END_REPEAT; + END_METHOD + END_CLASS +END_NAMESPACE \ No newline at end of file