Skip to main content

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.

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.

Enabled by default

Semantic highlighting is activated for all four languages out of the box via the extension’s configurationDefaults. No configuration is required. The extension also sets a few additional editor defaults for each language to improve the editing experience:
{
  "[turtle]": {
    "editor.semanticHighlighting.enabled": true,
    "editor.inlayHints.enabled": "on",
    "editor.tabCompletion": "onlySnippets",
    "editor.snippetSuggestions": "top"
  },
  "[trig]": {
    "editor.semanticHighlighting.enabled": true,
    "editor.inlayHints.enabled": "on",
    "editor.tabCompletion": "onlySnippets",
    "editor.snippetSuggestions": "top"
  },
  "[jsonld]": {
    "editor.semanticHighlighting.enabled": true,
    "editor.inlayHints.enabled": "on",
    "editor.tabCompletion": "onlySnippets",
    "editor.snippetSuggestions": "top"
  },
  "[sparql]": {
    "editor.semanticHighlighting.enabled": true,
    "editor.inlayHints.enabled": "on",
    "editor.tabCompletion": "onlySnippets",
    "editor.snippetSuggestions": "top"
  }
}
  • 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.
If you have previously set any of these to different values in your own settings.json, your override takes precedence. For example, set "editor.semanticHighlighting.enabled": false for a specific language to disable SWLS semantic tokens for that language only.

Custom semantic token types

In addition to the standard LSP token types (e.g. class, variable, namespace), SWLS registers two custom token types:
TokenSuper typeDescriptionExample
langTagkeywordLanguage tag on a string literal"hello"@en@en
booleankeywordBoolean literal valuetrue, false
Standard token types used by SWLS also include 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.
TokenTextMate scope
langTagkeyword.control
booleanconstant.language
enumentity.name.tag
enumMembersupport.constant
propertyentity.other.attribute-name
These scopes are widely supported across popular themes such as One Dark Pro, Dracula, GitHub Theme, and the built-in VS Code Dark+ and Light+ themes.

Example

The following Turtle snippet illustrates several token types that SWLS highlights semantically:
@prefix ex:   <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

ex:Alice a foaf:Person ;          # foaf:Person → enum (class)
    foaf:name "Alice"@en ;        # foaf:name → property; @en → langTag
    foaf:isPrimaryTopicOf ex:doc ;
    ex:active true .              # true → boolean
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.

Build docs developers (and LLMs) love