Giter Site home page Giter Site logo

codesnippetscollection's Introduction

Snippets collection

A collection of useful user defined snippets for AX Code.

Install the snippets collection

Before installing the snippets collection, the URL to the package registry need to be defined in the apax.yml

registries:
  '@simatic-ax': 'https://npm.pkg.github.com/'

To install the snippets collection to your workspace enter the following command in a terminal:

apax add @simatic-ax/snippetscollection --dev

to install this package you need to login into the GitHub registry. You'll find more information here

AXUnitSupport

Create a test fixture with AxUnit.Assert

"prefix": ["AxUnit test-fixture"]

Output example:

io

Insert Using AxUnit.Assert

"prefix": ["AxUnit, using ax"]

Output:

USING AxUnit.Assert;

AxUnit assertions

"prefix": ["eq, ne, lt, gt"]

Output:

Equal(expected := 0, actual := 0);
NotEqual(expected := 0, actual := 0);
LessThan(expected := 0, actual := 0);
GreaterThan(expected := 0, actual := 0);

Surround with

surround

Available surround with:

  • FOR ... END_FOR;
  • IF ... THEN ... ELSE
  • WHILE ... END_WHILE
  • REPEAT .. END_REPEAT

Snippets Namespace Support

NamespaceSupport

"prefix" : ["namespace, Siemens"]

namespace

Snippets for class support

"prefix" : ["class template, End_Class"]

Output:

NAMESPACE Simatic.Ax
    CLASS Untitled
        VAR PUBLIC
            
        END_VAR
        VAR PROTECTED
            
        END_VAR
        
        METHOD PUBLIC MyMethod
            ;
        END_METHOD
    END_CLASS
END_NAMESPACE

ClassMethodSupport

"prefix" : ["method, no return"]

Output:

METHOD PUBLIC|PRIVATE|PROTECTED MyMethod
    ;
END_METHOD

METHOD PUBLIC|PRIVATE|PROTECTED MyMethod : Type
     MyMethod := ;
END_METHOD

// types: BOOL,INT,LREAL,WORD,REAL,DINT,UINT,SINT

VAR sections within classes

"prefix" : ["varc"]

Output:

VAR PUBLIC|PRIVATE|PROTECTED 
    ;
END_VAR

VAR sections within methods and functions

"prefix" : ["vari"]

Output:

VAR_INPUT|VAR_OUTPUT|VAR_IN_OUT|VAR_TEMP|VAR CONSTANT
    count: INT;
END_VAR

Enumeration

"prefix" : ["enum"]

Output:

TYPE
    Colours : (RED, GREEN, BLUE) := RED;
END_TYPE

IO support

"prefix" : ["io"]

Support for creating IO Tags in the VAR_GLOBAL section. Suported types BOOL, BYTE, WORD, DWORD

Output example:

io

Iterate ARRAY[*] Snippet

"prefix" : ["Iterate Array*"]

Output example:

io

Contribution

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 (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:

markdownlint **/*.md --fix

License and Legal information

Please read the Legal information

codesnippetscollection's People

Contributors

sjuergen avatar rauerj avatar kruegerfelix avatar thkindler avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.