Home » Support » Tutorials/Power Tips » UltraEdit » Syntax highlighting and code folding

IDM PowerTips

UltraEdit syntax highlighting and code folding

There have been several enhancements added to syntax highlighting in more recent versions of UltraEdit. We have summarized the most important changes below for your convenience.

Please note: If you're using our default wordfiles you shouldn't need to make any changes for these items as the wordfiles we provide do work as described below.

Brace Matching

UltraEdit has defaults for Open and Close Brace Strings for many languages. If no strings are specified in the wordfile, the defaults are used. Otherwise, the specified strings are used for brace matching.

Note: In order for your braces to match properly, the closing brace definition in the wordfile MUST be in the same position as the opening brace definition, in the list of brace strings.

Correct example:
/Open Brace Strings = "{" "(" "["
/Close Brace Strings = "}" ")" "]"

Incorrect example:
/Open Brace Strings = "{" "(" "["
/Close Brace Strings = "}"

Most users will not have to make any changes here because the default wordfiles do include the items above.

Code Folding

UltraEdit has defaults for Open and Close Fold Strings for many languages. If no strings are specified in the wordfile, the defaults are used. Otherwise, the specified strings are used for folding.

Correct example:
/Open Fold Strings = "{" "If" "ElseIf"
/Close Fold Strings = "}" "ElseIf" "End If"

Most users will not have to make any changes here because the default wordfiles do include the items above.

Spell Checking (Spell check as you type)

By default UltraEdit and UEStudio will not perform "spell check as you type" on any syntax-highlighted files. To change this setting and allow "spell check as you type" for a syntax-highlighted file, add the following to the language definition line (e.g., /L3"HTML" ...) of the wordfile:

EnableSpellasYouType

If you wish to enable "spell check as you type" for a certain language, you will need to add the above string to your wordfile. It is case-sensitive. The appropriate spell check option must also be selected in the advanced configuration to support this.

Multi-Language Highlighting

UltraEdit has improved syntax highlighting and it now supports multiple languages within a single file. This is specifically for HTML type files. To help facilitate this, additional language indicators have been added to the default wordfile and most users shouldn't have to make any changes here. If you're not using the default wordfile these items should be added to the wordfile.txt file.

Example:
If an HTML file includes PHP then the syntax highlighting section must exist in the main wordfile and the PHP section should include in the definition line: PHP_LANG.

So, the default HTML language section has the HTML_LANG string:

/L3"HTML" Nocase Noquote HTML_LANG ...

and the PHP language section includes the PHP_LANG string:

/L8"PHP" Nocase PHP_LANG ...

This has been changed, as the default PHP wordfile used to include the HTML_LANG string:

/L8"PHP" Nocase HTML_LANG ...

Currently, UltraEdit uses the language markers shown below to correctly highlight multiple languages within a file. In the future UltraEdit may make further use of these languages markers in the wordfile, so if you are creating or editing a wordfile that contains any of the language types listed below the appropriate language string should be included.

Language StringFile Type
C_LANGC/C++
COBOL_LANGCobol
FORTRAN_LANGFortran
PASCAL_LANGPascal
PERL_LANGPerl
PLB_LANGPlb
VB_LANGVisual Basic
VBSCRIPT_LANGVb Script
ASP_LANGASP
CSHARP_LANGC Sharp
CSS_LANGCSS
LATEX_LANGTeX / LaTeX
HTML_LANGHTML
JAVA_LANGJava
JSCRIPT_LANGJavascript
ECMA_LANGEcma / Ecmascript
PHP_LANGPHP
PYTHON_LANGPython
XML_LANGXML
MATLAB_LANGMatlab script
MASM_LANGMicrosoft Assembler
AASM_LANGAT&T Assembler
NASM_LANGNetwide Assembler

NOTE: If your wordfile contains multiple occurrences of the HTML_LANG language marker, this must be corrected or some languages may not highlight correctly. UltraEdit allows only one instance of a language marker (i.e., C_LANG, COBOL_LANG, HTML_LANG) in a wordfile.

The following file extensions were moved to the HTML section of the default wordfile: php, asp, and jsp. This was done to facilitate correct HTML highlighting at the outer language level of the file even when no language tag is specified within the file. All php, asp, and jsp sections of the files are highlighted correctly based on language start and end tags ( for example), however a "View As" will show the file as HTML type.