VS Code supports two layers of syntax highlighting: syntactic (TextMate grammar-based, applied at parse time) and semantic (LSP-driven, applied after the language server analyzes the document). SWLS participates in the semantic layer for all four supported languages — Turtle, TriG, JSON-LD, and SPARQL — delivering richer, more accurate coloring that reflects the actual meaning of each token rather than just its surface form.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/SemanticWebLanguageServer/swls-vscode/llms.txt
Use this file to discover all available pages before exploring further.
Enabled by default
Semantic highlighting is activated for all four languages out of the box via the extension’sconfigurationDefaults. No configuration is required. The extension also sets a few additional editor defaults for each language to improve the editing experience:
editor.semanticHighlighting.enabled— enables the LSP-driven semantic token layer for SWLS tokens.editor.inlayHints.enabled— shows inlay hints (e.g. resolved prefix URIs) inline in the editor.editor.tabCompletion—"onlySnippets"makes the Tab key cycle through snippet completions only, avoiding conflicts with standard completions.editor.snippetSuggestions—"top"places snippet items at the top of the completion list.
Custom semantic token types
In addition to the standard LSP token types (e.g.class, variable, namespace), SWLS registers two custom token types:
| Token | Super type | Description | Example |
|---|---|---|---|
langTag | keyword | Language tag on a string literal | "hello"@en → @en |
boolean | keyword | Boolean literal value | true, false |
enum, enumMember, and property, which map to well-known ontology constructs.
TextMate scope mappings
Each semantic token type maps to a standard TextMate scope, which means every VS Code color theme that assigns colors to those scopes will automatically style SWLS tokens correctly — no theme-specific configuration needed.| Token | TextMate scope |
|---|---|
langTag | keyword.control |
boolean | constant.language |
enum | entity.name.tag |
enumMember | support.constant |
property | entity.other.attribute-name |
Example
The following Turtle snippet illustrates several token types that SWLS highlights semantically:The
langTag and boolean custom types are contributed by SWLS itself. If a color theme does not explicitly style keyword.control or constant.language, those tokens may appear in the theme’s default foreground color.