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.

SWLS (Semantic Web Language Server) is a VS Code extension that brings full IDE support to Semantic Web languages. It covers Turtle, TriG, JSON-LD, and SPARQL — offering autocompletion, diagnostics, formatting, SHACL shape validation, hover documentation, semantic highlighting, and more. On desktop, SWLS checks the swls.command setting first, then looks for a native swls binary bundled in its extension directory; if neither is present it falls back to a WASM worker so the language server is available immediately with zero extra setup. In browser-based VS Code environments (such as vscode.dev), SWLS runs entirely via a Web Worker.

Supported languages

LanguageExtensionsEnabled by default
Turtle.ttl✅ Yes
TriG.trig✅ Yes
JSON-LD.jsonld, .json✅ Yes
SPARQL.sq, .rq⚠️ Experimental — disabled by default
SPARQL support is still experimental. Enable it by setting "swls.sparql": true in your VS Code settings.

How it works

SWLS adapts its startup strategy to the environment it is running in:
  • Desktop (Node.js) — On activation, the extension resolves the server binary in order: first it checks whether swls.command is set in your VS Code settings and uses that path if so; otherwise it looks for a native swls (or swls.exe on Windows) binary in its own extension directory. If a binary is found either way, it is spawned as a child process and communicates via stdio using the Language Server Protocol. This path offers the lowest latency and CPU overhead.
  • Desktop WASM fallback — If no native binary is present, the extension loads a bundled WASM build of the language server inside a Node.js worker_threads Worker. The worker communicates via postMessage, and the client bridges that to LSP’s Content-Length framing. This means the full feature set is available the moment you install the extension, before any binary download.
  • Browser (vscode.dev / GitHub Codespaces web) — The browser entry point in the extension manifest (browserClientMain) spins up a Web Worker using the VS Code Worker API and runs the WASM server bundle inside it. No Node.js APIs are used; all file-system requests are proxied back to the extension host through custom LSP request handlers (custom/readFile, custom/readDir, custom/glob, etc.).
In the background, the extension periodically checks GitHub Releases for a newer native binary and prompts you to install or update. After a download the window reload switches over from WASM to the faster native process.

Key features

Diagnostics

Instant feedback for syntax errors, undefined prefixes, and SHACL shape violations as you type.

Completion

Prefix expansion, property suggestions ordered by domain relevance, and class suggestions when the predicate is a.

Hover & Rename

Hover over any IRI to see its label, description, and class information. Rename terms that are local to the current file.

Formatting

Format Turtle and JSON-LD documents with VS Code’s built-in Format Document command.

Semantic Highlighting

Full semantic token highlighting across all four supported languages, including custom token types for language tags and boolean literals.

SHACL Validation

Load SHACL shapes via swls.shapes and get live violations reported as diagnostics inline in your editor.

Build docs developers (and LLMs) love