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 activates the moment you open a supported file — no configuration required. This guide walks through the core features using a Turtle file so you can see completions, diagnostics, hover documentation, and formatting in action within minutes of installing the extension.

Prerequisites

  • VS Code >=1.100.0
  • The SWLS extension installed (see Installation)

Walkthrough

1

Open a Turtle file

Create a new file named example.ttl and paste the following content:
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ex:   <http://example.org/> .

ex:alice a foaf:Person ;
    foaf:name "Alice" ;
    foaf:mbox <mailto:alice@example.org> .
As soon as the file is open, SWLS activates (you will see swls appear in the Output panel) and begins parsing the document.
2

Trigger prefix completion

On a new line, type foaf and pause. SWLS will offer a snippet completion that expands the short prefix name into a full @prefix declaration:
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
Press Tab or Enter to accept. The prefix declaration is inserted at the top of the file and the cursor returns to your current position.
3

Use property completion

After the subject declaration, type a predicate position — for example, place your cursor after the trailing ; on ex:alice a foaf:Person ; and press Space. SWLS analyses the subject type (foaf:Person) and surfaces property suggestions ordered by domain relevance. Select foaf:name from the list to insert it along with a placeholder value.
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ex:   <http://example.org/> .

ex:alice a foaf:Person ;
    foaf:name "Alice" ;
    foaf:knows ex:bob .
Set "swls.completion.mode": "strict" in your settings to limit suggestions to properties whose declared domain matches the subject type.
4

View hover documentation

Hover over the IRI foaf:Person in the editor. SWLS fetches the FOAF ontology and displays the term’s label, description, and type information in a hover popup — without leaving the editor.
5

Check diagnostics

Delete the @prefix foaf: declaration from the top of the file and save. SWLS immediately underlines every occurrence of foaf: with a diagnostic error: Undefined prefix. The Problems panel (Ctrl+Shift+M) lists each violation with its file location.Restore the prefix declaration to clear the errors.
6

Format the document

Run Format Document (Shift+Alt+F on Windows/Linux, Shift+Option+F on macOS). SWLS rewrites the Turtle file with consistent indentation and spacing. If VS Code asks you to choose a formatter, select SWLS.

SPARQL support

SPARQL support is experimental and disabled by default. To enable it, add the following to your settings.json:
{
  "swls.sparql": true
}
Once enabled, SWLS activates for .sq and .rq files and provides the same diagnostics and semantic highlighting available for Turtle and TriG.
Because SPARQL support is still under active development, you may encounter incomplete features or rough edges. Bug reports and feedback are welcome on the issue tracker.

Next steps

Diagnostics

Learn about syntax errors, undefined prefix detection, and SHACL shape validation.

Completion

Explore prefix expansion, property completion modes, and class suggestions.

Settings reference

Full reference for every swls.* configuration setting.

Build docs developers (and LLMs) love