gbSnippets - Programmer Features

gbSnippets is a freeware program which provides an extremely easy-to-use method of storing and searching single and multi-line text data. In addition, it provides special features which make it useful as a source code librarian and programmers editor. Only these special features are covered on this page.

Overview

Even without its special programmer features, gbSnippets can serve as a code librarian for source code snippets. However, there are several features provided which further improve its usefulness as a programmers editor and code librarian.

gbSnippets makes no effort to compete with the leading Programmer's Editors. It does, however, try to provide enough editing features that programmers will feel comfortable in editing their source code within gbSnippets, before transferring the snippets to the language IDE.

Programmers Editor
gbSnippets contains a general purpose source code editor which provide syntax highlighting of keywords, comments, and strings. While not intended to be a replacement for the major programmers editors, gbSnippets nonetheless provides reasonable support for editing and displaying source code.

The editor provides other special features for programmers, such as batch indentation, line commenting, compilable template insertions, optional keyword case display (upper/lower/mixed/as typed) and insertion of a snippet directly into the language IDE.

gbSnippets also offers a dialog for comparing two snippets for differences - a side-by-side comparison of two blocks of code.

Multi-language support
Each snippet library can be associated with a programming language. That association will determine the syntax highlighting rules used to display the source code.

IDE Insertion
Snippets can be transferred from gbSnippets directly into the language IDE - ready for compilation or execution. An entire snippet, or just a selected part of a snippet, can be transferred.

A special portion of a snippet, called the compilable example can also be extracted from the snippet and placed in the language IDE.

Finally, a snippet (or selection) can be inserted into a user-defined template prior to being placed in the language IDE. Each language can have its own template. Additional, each library can designate a snippet as the template for only that library.

Snippet Libraries
Multiple source code libraries, which include over 1,000 snippets, are provided as part of the gbSnippets distribution.

Snippet libraries include primary code (just the basic code demonstrating a concept) as well as compilable code (the primary code wrapped in enough code to successfully compile in the language IDE and that demonstrates how the code works).

Libraries also include significant reference materials - command syntax, function descriptions, mini-tutorials and generous comments on each snippet.

Library Management
gbSnippets offers several features that help to handle multiple libraries. The QuickOpen feature allows a user to associate snippet files with up to three toolbar buttons for quick switching between frequently used snippet libraries. Library files can be merged (one imported into another) and procedures (Sub/Function) can be imported from the original language source code files.

gbSnippets snippet libraries are stored as text files. This enables the programmers to potentially use other editors to make batch changes - as long as the format integrity of the files are maintained. Libraries may also be exported to HTML files and gbSnippets can automatically generate index files with links to the various snippet files.

gbSnippets also offers simple library encryption to protect files against casual snooping.

OnLine Snippet Libraries & OnLine Snippet Libraries
All of the snippets distributed with gbSnippets can be found online at my PowerBASIC code archive.

gbSnippets provides the user with a means of downloading a daily text stream - which will contain either a message form the author or a snippet recently added to the library.

The gbSnippets distribution libraries may be downloaded from the gbSnippet home page. These will contain the most recent snippets available.

Note: snippet content is actually displayed in a RichEdit control. However, throughout this Help page the control may be referred to as a textbox.

Enabling Programmer's Features

By default the programmer's features are not displayed. To enable and display the menu, toolbar, and context menu features you must select the "Options/Programmer Features" menu option.

Here's the new look of the main menu and toolbar, showing the new Programmers menu item and the three new toolbar selections.

Main Menu
Here's a closer view that shows the now-visible "Programmers" menu item.

Toolbar
And here's a closer view of the three new selections on the toolbar.

TextBox Context Menu
The context menu for the node content textbox will now display 6 new entries, found at the bottom of the menu.

Programmers Menu
And finally, the dropdown portion of the main menu "Programmers" item has the following selections.

All of these programmer-specific options are discussed in the following paragraphs.

Language Support

gbSnippets is designed to support multiple languages, where each library file (*.gbs) contains snippets for a single language. On loading, gbSnippets identifies the language and uses the appropriate syntax highlighting.

The keyword list for each language is kept in the "languages" subfolder, in files named *.syn (powerbasic.syn, qbasic.syn, html.syn, ...). Syn files for c, c++, csharp, dos, html, java, javascript, perl, php, powerbasic, python, qbasic, quickbasic, sql, and visualbasic are included in the installation.

When a snippet library is created, it is assigned the language of the currently opened snippet library. To manually associate any snippet library with a language, simply use the Programmers/Language/Select Language menu option and select the appropriate language. When the file is saved, the language association is saved within the file.

Language selection determines how gbSnippets uses syntax highlighting (keywords, comments, and strings) for that language. Syntax highlighting parameters are built into gbSnippets - they are not defined in the *.syn files.

Keyword files (*.syn) and IDE templates (*.ide) are included in the gbSnippets distribution.

If you'd like gbSnippets to support a new language, let me know and I'll work to accommodate the request.

Current Limitations
The bottom line is that while I've written gbSnippets to handle multiple languages, it currently fully supports only PowerBASIC.

Programmers Menu Options

Here's a description of the Programmers menu options.

Context Menu - Programmer Options

Here's a description of the programmer-specific textbox context menu selections (the bottom 6 in the image).

Toolbar - Programmer Options

The toolbar provides quick access to some of the more often used features of gbSnippets.

Special Commands

As noted in the main Help page for gbSnippets, several "hidden" commands are supported which are typed in through the Search combobox. The programmer-specific commands of supported are:

Download Files

gbSnippets provides a built-in, online update for the EXE - but not for the various supplemental programmer files. The latest version of those files can be downloaded here.

The *.gbs, *.ide, and *.syn files are all text uncompressed text files. You can click on them to read them inside your browser. But to save to your PC, you must use your browser's right-mouse click, "Save Target/Link As ..." menu option.

All other files can be downloaded by the usual left-click on the link.

I value user input, so if you have suggestions please let me know!