# What's New in CodeSnip 4

CodeSnip v4 is a substantial update over previous versions. Here is a list of key new features of this version. All new features were introduced in v4.0 unless otherwise noted.

## Database Changes

- New "unit" and "class" snippet kinds that can include complete units and classes (and advanced records) in the database. Both can be test compiled and classes / advanced records can also be included in generated units.

- Snippets from both the main and user databases can now be duplicated using the Snippets | Duplicate Snippet menu option, by pressing Shift+Ctrl+D or by clicking the tool button.

  This is very useful if you have created a snippet and want to create another one that shares a lot of the source code, dependencies etc. Just duplicate the first one with a new name and edit it as required. It saves a lot of time.

  There's a second use where you can duplicate a snippet from the main database under the same name and make any tweaks you like to the new version: duplicate snippets are always editable.

- The Database now supports Unicode text for snippet names, descriptions etc., and for source code. Using Unicode for snippet names and source code will mean that the code will not compile on older compilers that don't understand Unicode source code or unit file names.
- There is now finer control over the warnings in generated code via the `$WARN` directive. This is controlled on the Code Generation page of the Preferences dialogue box.
- [v4.1] There is also finer control over the comments written to exported snippets and units, in that snippet comments can be restricted to display only the first paragraph of multi-paragraph snippet descriptions. Select this option from the Code Formatting page of the Preferences dialogue box.
- The names of referenced units may now contain dots so that Delphi namespaces can be used.
- [v4.3/v4.5.1] As of v4.3 the user defined snippets database can now be moved to a user specified directory. This useful for ensuring the database is backed up, for example by placing it in a Dropbox or GoogleDrive sub-folder. (This option is not available in the portable edition.) From v4.5.1 the database can also be relocated to a network drive.
- [v4.7] Snippets can now be imported from the SWAG (SourceWare Archive Group) collection of snippets.
- [v4.20] The user defined database can now be deleted.

## User Interface

- The new multi-tab display can display details of more than one snippet, category etc. in the main display. Ctrl click items in the overview pane, or links in the details pane, to display them in a new tab. See the Detail Pane help topic for more information.
- The main menu has been re-organised and there are new menu and toolbar glyphs.
- The structure of snippet pages in the details pane is now customisable: various page elements can be omitted and the order of elements can be changed. Each snippet type has its own page customisation. Use the Snippet Layout page of the Preferences dialogue box to do the customisation.
- [v4.1] The list of required units displayed on the References tab of the Snippets Editor, is now persistent and can be edited. (The rest of the References received a makeover at the same time).
- The number of compilers that appear in the compile results table in the details pane can now be limited. Use the Compiler tab of the Configure Compilers dialogue box to do this.
- The colours used for Snippet and other headings can now be customised using the Display page of the Preferences dialogue box.

- Snippets can now have an optional "display name" that, unlike the snippet's name, does not need to be unique. This is useful for giving meaningful names to snippets such as overloaded functions.

  For example snippets ResizeRect_A and ResizeRect_B in the online database now have display names ResizeRect (TSize overload) and ResizeRect (Longint overload) which are much more meaningful.

- Snippet descriptions can now be formatted and can contain multiple paragraphs, just like "extra" text. Both are edited using the new Markup Editor.
- Syntax highlighting of source code of user defined snippets can now be switched off on a per-snippet basis. This mainly of use for freeform snippets that may be used for notes or snippets in languages other than Pascal.

- Information about how a snippet from the online Code Snippets Database was tested is now displayed by means of a glyph at the top right of the detail pane, as follows:

  - the snippet has been given some basic testing before uploading to the database.
  - the snippet has been more rigorously tested, for example by unit testing.
  - the snippet has not been tested and should be used with care.
- The Welcome page has been completely redesigned to be cleaner and to provide more useful information about the databases and program.
- [v4.19.0/v4.20.0] From v4.19.0 the font size used in the overview pane can be customised. The ability to change the font size in the detail pane was added in v4.20.0.

## Favourites [v4.2]

- Users can now flag snippets as "Favourites". Press Shift+Alt+F or click the toolbar button to make the displayed snippet a favourite.
- A new non-modal dialogue box can be displayed alongside the main CodeSnip window where favourite snippets are listed. Snippets be quickly displayed from here. Display the dialogue box by pressing F4. Snippets can also be "un-favourited" from the dialogue box.

## Test Compilation

- You can specify the paths to be searched by Delphi compilers when looking for used units. This lets you compile snippets that use units other than those provided in the VCL and RTL. For example you can specify a path to the Indy components to compile them.

  Use the Configure Compilers dialogue box to set the paths on a per-compiler basis.

- Results of test compilations (F9) now appear in a dialogue box instead of in a tab in the detail pane.
- [v4.3] It is now easier to specify the namespaces to be searched for unqualified RTL and VCL units names by entering the required namespaces in the Namespaces tab of the Configure Compilers dialogue box.
- [v4.21.0] CodeSnip now detects newly installed Delphi compilers at start up.

## Other Features

- [v4.1] CodeSnip is now available in both standard and portable editions. The former is the normal version which is designed to run on one computer and to be able to maintain different user databases for each logged on user. The new portable edition will run from removable storage and maintains a single copy of the main and user databases on the same storage device. This makes it suitable for use by a single user on more than one computer.
- Text and compiler searches can now optionally refine a previous search rather than always searching the entire database. More information.
- The contents of a category can now be printed.

For other features of v4 please read the change log for this release and all preceding v4 releases, including alpha (preview) and beta releases and release candidates.