Customize highlighting
Change the color of a category without changing your entire theme. This guide combines the token reference with settings you can copy into VS Code.
Set your first color
Section titled “Set your first color”- Open a local
.gppfile. Check that the language indicator in the lower-right corner says GPPL. - Press Ctrl+Shift+P and run Preferences: Open User Settings (JSON). Use the editable user settings, not the read-only default settings.
- Add the following settings inside the outer
{ }. If these keys already exist, merge their contents instead of adding a second copy. Preserve your other settings, including file encoding. - Save
settings.jsonand return to the.gppfile. Single-quoted strings should become orange; double-quoted strings should become pale blue. No extension reload is normally needed.
{ "[gppl]": { "editor.semanticHighlighting.enabled": true }, "editor.semanticTokenColorCustomizations": { "rules": { "string:gppl": "#9CDCFE", "string.format:gppl": "#FF8000" } }}Replace #FF8000 with your preferred hexadecimal color. These example colors suit a dark background; choose colors that remain readable with your theme. Remove only the rule you added to restore the theme’s color.
The selector string.format:gppl means type string, modifier format, language gppl. A base rule such as string:gppl also matches strings with modifiers; the more specific string.format:gppl rule distinguishes single quotes. These are category rules, not a way to assign a color to one variable name. Use the exact selector spelling shown here, even when your GPPL code uses uppercase names.
A complete color example
Section titled “A complete color example”Since 1.7.0: this example covers every base type and the additional categories. It works with your chosen theme; selecting GPPL Classic Dark is optional. Merge it into your existing settings as described above.
{ "[gppl]": { "editor.semanticHighlighting.enabled": true, "editor.bracketPairColorization.enabled": false }, "editor.semanticTokenColorCustomizations": { "rules": { "variable:gppl": "#D4D4D4", "variable.readonly.defaultLibrary:gppl": { "foreground": "#9CDCFE", "italic": true }, "variable.readonly.defaultLibrary.boolean:gppl": { "foreground": "#FFC042", "italic": false, "underline": false }, "parameter:gppl": "#B5CEA8", "function:gppl": "#DCDCAA", "function.defaultLibrary:gppl": "#00CACA", "function.systemProcedure:gppl": "#4EC9B0", "function.userProcedure:gppl": "#F5CB49", "keyword:gppl": "#C586C0", "keyword.interrupt:gppl": { "foreground": "#FF6666", "bold": true, "italic": true }, "keyword.line:gppl": "#D7BA7D", "namespace:gppl": "#C586C0", "class:gppl": "#FF8000", "string:gppl": "#CE9178", "string.format:gppl": "#FF8000", "number:gppl": "#B5CEA8", "comment:gppl": "#8A9980", "operator:gppl": "#D4D4D4", "operator.comparison:gppl": "#F78C6C", "operator.logical:gppl": "#C586C0", "operator.generation:gppl": "#FFD700", "operator.separator:gppl": "#89DDFF" } }}Bracket-pair colorization is disabled here so that your operator.generation color remains visible. Bracket matching and Go to Bracket still work. To keep VS Code’s bracket colors, leave colorization enabled and omit this setting.
Try it on GPPL code
Section titled “Try it on GPPL code”Save this as a separate local .gpp file to inspect the categories. It is an editor exercise, not a complete machine postprocessor. The code block on this website uses static syntax coloring; your VS Code colors come from your own settings.
@init_post global numeric demo_value demo_value = abs(-2)endp
@start_of_file ; Compare the word and symbolic forms. if demo_value eq 2 and not(active(demo_value)) then {nb "X" demo_value:'5.3'} endif if demo_value != 0 then change(demo_value) = true call @usr_demo(demo_value) endifendp
@usr_demo(numeric demo_argument) print demo_argument:'5.3'endp@init_post and @start_of_file are system procedures even though you write their bodies. @usr_demo is a user procedure, demo_argument is a parameter, and abs, active and change are built-in functions. eq and != intentionally use different selectors; see the operator table below.
Token reference
Section titled “Token reference”The tables omit the :gppl suffix to keep selectors readable. Add it in your settings to affect GPPL only. Categories describe the IDE’s highlighting, not runtime behavior or whether a name is valid.
Base categories
Section titled “Base categories”These ten base types exist in 1.6.3 and remain available in version 1.7.0. Rules also match their modified forms.
| Selector | GPPL elements |
|---|---|
variable |
Local/global variables and unresolved ordinary identifiers; system names have additional modifiers. |
parameter |
Procedure parameters in declarations and resolved uses. |
function |
Procedure names, function tokens, and the procedure terminator endp. |
keyword |
Control flow (if, then, elseif, else, endif, while, endw), call, inc, print, input, trace, col, colrel. |
namespace |
Scope keywords global and local; GPPL does not gain namespaces from this token name. |
class |
Type keywords integer, numeric, logical, string; this is a highlighting name, not an object-oriented class. |
string |
String literals; single quotes additionally receive format. |
number |
Integer, decimal and scientific literals. |
comment |
Semicolon comments, including ;;; documentation comments. |
operator |
Arithmetic, assignment and symbolic comparisons; version 1.7.0 adds the subgroups below. |
Existing distinctions
Section titled “Existing distinctions”| Selector | What it selects |
|---|---|
string.format |
All single-quoted literals, such as '5.3'; quote style determines this category, not the content. |
keyword.interrupt |
abort, exit, break, return. |
variable.readonly.defaultLibrary |
System variables from the catalog, such as xpos and pi. |
variable.readonly.defaultLibrary.boolean |
The literals true and false. |
variable.declaration |
Variable declarations. |
parameter.declaration |
Parameter declarations. |
function.declaration |
Procedure declarations; add a procedure-category modifier to narrow this further in version 1.7.0. |
The readonly modifier is also used to style system names. It is not proof that assigning to a variable is forbidden. Assignment restrictions are reported separately by diagnostics, for example for pi. There are no separate semantic selectors for local versus global variable names or for VMID variables; namespace colors the words local and global themselves.
Operator groups
Section titled “Operator groups”Since 1.7.0: the groups are independent. They do not split a token inside a string, comment or longer identifier such as eq_value.
| Selector | Tokens |
|---|---|
operator |
+ - * / ^ = == != < > <= >= without a subgroup modifier. A broad rule also matches the subgroups unless a more specific rule supplies the style. |
operator.comparison |
Only the word comparisons: eq ne lt gt le ge. |
operator.logical |
and or not !, including not(...) and !(...). |
operator.generation |
The pair { } bounding generation output. Other brackets are not in this group. |
operator.separator |
: before an output format in a generation block, print or tostr, and before the level in trace "all":5. |
== and != share plain operator; neither has its own category. != is a comparison, not a logical negation, and its ! is not a separate token. In 1.6.3 the word comparisons and and/or/not are keywords, while ! is a plain operator; the new subgroup selectors require version 1.7.0.
Functions, procedures and output controls
Section titled “Functions, procedures and output controls”Since 1.7.0: use three function selectors when you want three independent colors.
| Selector | Examples and boundaries |
|---|---|
function.defaultLibrary |
Catalogued built-ins: abs, tostr, get_axis_vector, change, active, even, odd, date, time. Logical functions keep this category on either side of an assignment. |
function.systemProcedure |
Catalogued @ procedures, including declarations with a user-written body and calls. Example: @init_post. |
function.userProcedure |
Other @ names, including user procedures and unresolved names. This color does not mean a procedure was found. |
keyword.line |
nb and nl, which control the output block or line. |
endp remains plain function. In 1.6.3 change, active, even, odd and nb/nl are keywords; the three function groups are not yet consistently distinguished as described above. A declared variable with a builtin-like name is not automatically a function call.
Modifiers and narrower rules
Section titled “Modifiers and narrower rules”The emitted modifiers are declaration, readonly, defaultLibrary, boolean, interrupt, format and, in version 1.7.0, comparison, logical, generation, line, systemProcedure, userProcedure, separator. definition is reserved in the legend but is not currently emitted; a rule using it will not select declarations.
Combine modifiers when useful: function.userProcedure.declaration:gppl selects user procedure declarations, while function.userProcedure:gppl selects both declarations and calls. For example, add "function.userProcedure.declaration:gppl": { "bold": true } to the rules object. Styles can specify foreground, bold, italic, underline and strikethrough; a color rule alone does not clear existing font styles.
TextMate fallback
Section titled “TextMate fallback”Use semantic rules above for normal IDE work. If you deliberately disable semantic highlighting, colors come from lexical TextMate scopes through editor.tokenColorCustomizations.
In 1.6.3 our TextMate grammar covers only strings and comments. The expanded table below is for version 1.7.0 and the GPPL language mode.
| TextMate scope | Elements |
|---|---|
comment.line.semicolon.gppl |
Comments. |
string.quoted.single.gppl |
Single-quoted literals. |
string.quoted.double.gppl |
Double-quoted literals. |
constant.character.escape.gppl |
Recognized escape sequences within strings. |
entity.name.function.procedure.gppl |
All @ procedure names together. |
support.function.builtin.gppl |
Builtin names, matched lexically. |
keyword.control.gppl |
Control-flow/statement keywords and endp. |
keyword.control.interrupt.gppl |
abort/exit/break/return. |
keyword.control.line.gppl |
nb/nl. |
entity.name.namespace.gppl |
global/local. |
entity.name.type.class.gppl |
Type keywords. |
constant.language.boolean.gppl |
true/false. |
constant.numeric.gppl |
Numbers. |
keyword.operator.gppl |
Arithmetic, assignment and symbolic comparisons. |
keyword.operator.comparison.word.gppl |
Word comparisons. |
keyword.operator.logical.gppl |
Logical operators. |
punctuation.section.generation.gppl |
{ }. |
keyword.operator.separator.gppl |
:. |
There is no lexical scope distinguishing ordinary variables, parameters, system variables or declaration sites. All @ procedures share one scope, and builtin names do not resolve shadowing. With semantic highlighting on, whole-string semantic tokens can also override TextMate escape colors. These are limits of the fallback, not extra semantic selectors.
{ "[gppl]": { "editor.semanticHighlighting.enabled": false, "editor.bracketPairColorization.enabled": false }, "editor.tokenColorCustomizations": { "textMateRules": [ { "scope": "keyword.operator.comparison.word.gppl", "settings": { "foreground": "#F78C6C" } }, { "scope": "punctuation.section.generation.gppl", "settings": { "foreground": "#FFD700" } }, { "scope": "entity.name.function.procedure.gppl", "settings": { "foreground": "#F5CB49", "fontStyle": "bold" } } ] }}To add another category, copy one object into textMateRules and replace its scope using the table. Semantic settings go under rules; TextMate settings go under textMateRules. They are different formats.
GPPL, GPP and themes
Section titled “GPPL, GPP and themes”For the SolidCAM extension’s GPP mode, change :gppl to :gpp in semantic selectors and [gppl] to [gpp] in language settings. Keep both sets if you use both modes. The GPPL IDE server supports both IDs. With semantic highlighting off, GPP uses the installed SolidCAM extension’s grammar: the GPPL TextMate scopes above are not guaranteed there.
The examples are outside any theme-name block, so they apply across themes. To select the bundled theme, follow Color theme and highlighting. Its display name is GPPL Classic Dark, but its settings ID stays GPPL UltraEdit, including [GPPL UltraEdit] customization blocks. Existing theme-specific overrides can affect the result; check them when switching themes.
Find out why a color did not change
Section titled “Find out why a color did not change”- Confirm that your installed version includes the selector. New categories will not take effect in 1.6.3.
- Check the language mode and suffix: GPPL uses
gppl; SolidCAM’s GPP mode usesgpp. - In Settings, check the effective Editor: Semantic Highlighting Enabled value for that language, including workspace overrides. Use
truefor semantic rules orfalsefor the TextMate example. - Place the caret on the token and run Developer: Inspect Editor Tokens and Scopes from the Command Palette. Check the semantic type, modifiers, TextMate scopes and the rule supplying the foreground. Press Esc to close the inspector.
- Look for a more specific rule, a theme-specific block or duplicate settings keys. For
{ }, disable Editor: Bracket Pair Colorization Enabled to see the category color. A broadfunctionoroperatorrule also matches tokens with modifiers. - If no semantic token is shown, confirm that the extension is active for the open file. Follow Troubleshooting if language features are also unavailable. Remove your added rule to compare with the theme default.
For VS Code’s selector syntax and styling options, see the official semantic highlighting guide and theme customization guide.