Snippet Kinds

CodeSnip is more than just a simple repository for your code snippets. If you're using Pascal it can do some other things like generate compilable units and test-compile your code. To be able to do this CodeSnip needs to know something about your code. For that reason each snippet must be identified as one of six kinds, and there are rules governing the layout of the source code for each kind. The six kinds are:

  1. A routine
    This is simple function or procedure, not a method.
    Learn more.
  2. A simple type definition
    This is a basic type definition, not a class, object or advanced record.
    Learn more.
  3. A constant definition
    This is what it says – a definition of one or more constants or typed constants.
    Learn more.
  4. A class / advanced record definition
    This is either a class or an advanced record (with methods). This type of snippet has separate declaration and definition sections.
    Learn more.
  5. A unit
    This comprises a complete source code unit. A unit is test compiled on its own and, for obvious reasons can't be inserted into generated units.
    Learn more.
  6. Freeform code
    A catch all for any snippet that is not one of the above types. Can contain anything. Freeform code can't be included in a generated unit and neither can it be test complied. This kind is also used for non-Pascal code.
    Learn more.

If you want to be able use all of CodeSnip's functionality you must designate each of your Pascal snippets as one of the the first five kinds. Use the "learn more" links to find out what you need to do to comply with the requirements. Another way to learn is to examine the code from the main DelphiDabbler Code Snippets database, since it all conforms.

On the other hand if you don't use Pascal or don't need CodeSnip's advanced support for Pascal code, just designate everything as freeform. Or mix and match. It's up to you.