This chapter describes the language-specific editing features of SlickEdit Core.
Many features in SlickEdit® Core are language-specific and based on the language editing mode. You can also configure different settings for different languages. See Language-Specific Options and Language Editing Mode below for more information.
Preferences for language-specific features can be set through the SlickEdit Preferences dialog (Window → SlickEdit Preferences → Languages → [Language Category] → [Language] or config command). A shortcut method to access language options for the current buffer is to use the Format → [Language] Options menu item, or the setupext command. This will open the SlickEdit Preferences dialog to the General language-specific option screen for that language. See Language Options for more information.
SlickEdit® Core uses the extension of the current file to determine what language you are using, thereby only making available the options and features that are possible in that language.
If you have a file with a non-standard extension or no extension at all, you will need to manually specify the language editing mode. To specify a mode, from the main menu click Format → Select Mode (or use the select_mode command). The Select Mode dialog is displayed with a list of modes from which to select.
Supported languages are listed in the Language Manager (Window → SlickEdit Preferences → Languages → Language Manager). You can use this tool to add languages and delete languages you have added.

Installed languages are denoted in the list with a SlickEdit bitmap. Use the filter box at the top of the language list to search the list incrementally as you type. Use the Add Language and Delete Language buttons to add and remove languages (see Adding and Removing Languages below). Click Settings to jump to the Language-Specific General Options screen for the selected language.
To add a language, complete the following steps:
Click Add Language on the Language Manager screen. The Add New Language dialog is displayed.

In the Mode name field, type a name for the new language (for example, C/C++, Java, etc.).
In the Associated extensions field, type the file extension(s) associated with this language. Separate each extension with a space, and do not include the dot character (for example: chcccp). The extensions you list here, if not already defined, are added to the File Extensions list on the File Extension Manager. If you specify an extension that already exists and is associated with another language, a confirmation prompt is displayed.
To see a list of file extensions that are associated with a language, see the language-specific General options page (Window → SlickEdit Preferences → Languages → [Language Category] → [Language] → General).
In the Color coding lexer name field, specify the language identifier so that SlickEdit® Core knows what elements to color. Use the drop-down list to select the lexer.
If you wish to copy settings from an existing language, check the Copy settings from checkbox and select the language from the combo box. Then check any boxes that correspond to settings you wish to copy from the selected language to your new language. These options are organized by their respective nodes in the options dialog. For more information, see Language Options.
Click Add Language. The new language will be displayed in the Languages list as well as the list of document language modes on the Select Mode dialog (Format → Select Mode).
To delete a language you have added, select it in the Language list and click Delete Language. Installed languages cannot be deleted.
The File Extension Manager (Window → SlickEdit Preferences → Languages → File Extension Manager) is used to add and work with file extensions in SlickEdit® Core.

Recognized file extensions are listed in the File Extensions list. There is also an All Extensions item in the list to allow you to set certain settings for all known extensions. See Adding and Removing File Extensions for more information.
The settings on the File Extension Manager screen are described as follows:
Associate with language - This drop-down shows the language that is associated with the selected file extension. Associations are created when you add a new language using the Language Manager. You can use this field to change the language association.
Language Setup - Click this button to jump to the language-specific General options screen, which shows a list of file extensions associated with the selected language and provides general language-specific options.
Encoding - Each extension can have its own encoding specification. Both the language-specific and global option settings are overridden if an encoding is previously specified in the Open dialog box. The encoding used to override default encoding settings is recorded and this setting is used the next time the same file is opened. This provides per-file encoding support. If the extension-specific encoding is set to Default, then the global setting defined on the Load File Options screen (Window → SlickEdit Preferences → File Options → Load) is used. You can set the encoding for all extensions at once by selecting All Extensions in the File Extensions list and then selecting the encoding you want. Note that Unicode support is required to work with encodings. For more information about working with encodings and Unicode, see Encoding.
If SlickEdit® Core does not provide a file extension that you need to use, you can add it. If you have added a new language to SlickEdit Core with a file extension that was not already defined, the new extension is added to the File Extension list automatically. Or you can just add a new extension by clicking New, and the New Extension dialog is displayed.

Enter the new file extension in the Extension box (without the dot character), then select the associated language from the Language drop-down list and click OK. If the language does not exist, cancel this dialog and add it using the Language Manager first (see Adding and Removing Languages).
To delete the selected extension from the File Extensions list, click Delete.
When you open a file within the application, the extension is used to determine which language mode should be associated with the file. You can also use the Extensionless File Manager to associate languages to files that do not have extensions. There are two mechanisms used to map files to languages: file mapping and pattern mapping. Each type has its own list of mappings in the Extensionless File Manager, which can be accessed by going to Window → SlickEdit Preferences → Languages → Extensionless File Manager and is seen below.

If you wish to select a specific file and map it to a language, add it to the Files list. Use the Add button next to the Files list to add a file mapping. Select your file and language and click OK.

Now that file is treated as a file of the language you specify. You can edit or delete a file mapping using the appropriate buttons.
You can also specify mappings for files that match a certain pattern. For instance, if you want all files that are named "foo" or all files located in “C:\bar\” to be mapped to a specific language, you can set up a pattern mapping.
To create a pattern map that matches a filename, click the Add filename button. You can select a file using the ... button or you can simply type in a filename. You can use * as a wildcard in the filename. Select the language you want. When you click OK, the filename pattern will be added to the list. Notice that the filename will be translated into an Ant pattern that will match any file in any directory with that name.

To create a pattern map that matches a directory, click the Add path button. Select a path using the ... button or type one in. Use the Recursive checkbox to specify if you want all files below that directory or only files directly under it. Select the language you want and click OK. When the item is added to the list, it will be translated into an Ant pattern that matches files under that directory.
If you wish to create a more complex pattern than a simple filename or path match, use the Add pattern button. You can enter your own Ant pattern and map it to a language.

The mappings in the Patterns list can be re-ordered. When an extensionless file is encountered, the top mapping is checked first. If the file matches the pattern, then the associated language is used. If not, then the second pattern is checked. Each pattern is tested against the file until a match is found. Use the Move up and Move down buttons to reorder the patterns in order of desired precedence. Use the Edit and Delete buttons to do the respective actions.