Bosak XPath / XSLT — VS Code Extension
Language support for XPath 3.1 and XSLT 3.0 powered by the Bosak engine.
Features
- Syntax highlighting for XPath (
.xpath), XSLT (.xsl, .xslt), and XQuery (.xq, .xqy, .xquery) files
- Realtime diagnostics — compile errors for XPath expressions, XSLT stylesheets, and XQuery documents
- Auto-completion — XPath functions, axes, keywords, XSLT instructions, and XQuery keywords
- Hover — function signatures and descriptions for XPath/XQuery functions
- Go to definition — jump to user-defined XSLT functions, variables, parameters, and named templates; XQuery functions and variables
- Semantic highlighting — function names, variables, namespace prefixes, keywords, and type names in XPath, XQuery, and XSLT
- Code actions — quick fixes for common diagnostics (e.g. declaring a default element namespace)
- Code lens — inline evaluation results for XPath/XQuery expressions, plus one-click "Run XSLT transformation" and "Run initial template" actions
- Document outline — top-level XSLT declarations (templates, functions, variables, keys, output, imports) and XQuery declarations (modules, imports, functions, variables)
- Evaluate XPath — run the current
.xpath file and show the result
- Run XSLT Transformation — run the current stylesheet against a selected source XML document
- Run XQuery — run the current
.xq file and show the result
Prerequisites
| Tool |
Version |
Notes |
| .NET SDK |
10.0+ |
Required to build and run the language server |
| Node.js |
18.x+ |
Required to build the extension |
| VS Code |
1.80+ |
|
Installation
Option 1 — Development / Sideload (recommended for contributors)
Build the language server
cd /path/to/Bosak
dotnet build src/Bosak.LanguageServer/Bosak.LanguageServer.csproj
Install extension dependencies
cd vscode-bosak
npm install
Compile the extension
npm run compile
Open in VS Code and press F5
This opens a new Extension Development Host window with Bosak loaded.
Option 2 — Install from VSIX
Build the extension package
cd vscode-bosak
npm install
npm run compile
npx vsce package
Install the VSIX in VS Code
- Open VS Code → Extensions view (
Ctrl+Shift+X)
- Click ⋯ (More Actions) → Install from VSIX…
- Select
vscode-bosak-0.1.4.vsix
Option 3 — Custom server path
If the extension cannot find the language server automatically, set the path manually:
// .vscode/settings.json
{
"bosak.server.path": "D:/Development/Bosak/src/Bosak.LanguageServer/bin/Debug/net10.0/Bosak.LanguageServer.exe"
}
Usage
Opening files
Create or open files with the following extensions:
| Language |
Extensions |
| XPath |
.xpath |
| XSLT |
.xsl, .xslt |
| XQuery |
.xq, .xqy, .xquery |
The extension activates automatically when an XPath, XSLT, or XQuery file is opened.
Diagnostics
Errors appear in the Problems panel (Ctrl+Shift+M) as you type:
- XPath files — parser errors when the expression is invalid
- XSLT files — XML well-formedness errors, missing root element (
xsl:stylesheet / xsl:transform), and invalid XPath in select, test, match, and use-when attributes
- XQuery files — prolog and expression compile errors
Completions
Press Ctrl+Space to trigger suggestions:
- In XPath files: standard
fn:* functions, axes (child::, descendant::, …), and keywords (for, let, if, …)
- In XSLT files: all of the above plus XSLT instructions (
xsl:template, xsl:apply-templates, …)
Commands
| Command |
Where |
What it does |
| Bosak: Evaluate XPath Expression |
Editor context menu (.xpath files) |
Evaluates the current file and opens the result in a preview editor |
| Bosak: Run XSLT Transformation |
Editor context menu (.xsl / .xslt files) |
Prompts for a source XML document, runs the stylesheet, and opens the result |
| Bosak: Run XQuery |
Editor context menu (.xq files) |
Runs the current XQuery document and opens the result |
| Bosak: Evaluate XQuery Expression |
Command Palette (XQuery files) |
Same as Run XQuery |
| Bosak: Run XSLT Initial Template |
Command Palette (XSLT files) |
Runs the stylesheet via its initial template (chosen on the server) and opens the result |
Results are evaluated by the language server and shown in a preview editor; errors appear as VS Code notifications.
Configuration
| Setting |
Type |
Default |
Description |
bosak.server.path |
string \| null |
null |
Absolute path to the Bosak.LanguageServer executable or DLL. When null, the extension searches the workspace for a built server. |
bosak.trace.server |
string |
"off" |
Traces LSP communication between VS Code and the server. Values: "off", "messages", "verbose". |
Enable verbose logging
{
"bosak.trace.server": "verbose"
}
Open Output panel (Ctrl+Shift+U) → select Bosak XPath / XSLT to view the LSP traffic.
Troubleshooting
"Bosak language server not found"
The extension could not locate Bosak.LanguageServer.exe (or .dll). Make sure:
- You have built the .NET solution:
dotnet build Bosak.sln
- The server binary exists at:
src/Bosak.LanguageServer/bin/Debug/net10.0/Bosak.LanguageServer.exe
- Or set
bosak.server.path explicitly in VS Code settings.
No diagnostics showing
- Check that the file has the correct extension (
.xpath, .xsl, .xslt, .xq, .xqy, .xquery).
- Open Output → Bosak XPath / XSLT and look for connection errors.
- Enable
"bosak.trace.server": "verbose" to inspect LSP messages.
Server crashes on startup
Run the server standalone to see the error:
dotnet src/Bosak.LanguageServer/bin/Debug/net10.0/Bosak.LanguageServer.dll
If it exits immediately, check for missing dependencies (dotnet --info).
Development
Project layout
vscode-bosak/
├── package.json # Extension manifest
├── tsconfig.json # TypeScript config
├── src/
│ └── extension.ts # Client entry point
├── syntaxes/
│ ├── xpath.tmLanguage.json # XPath TextMate grammar
│ └── xslt.tmLanguage.json # XSLT TextMate grammar
└── language-configuration.json # Bracket/symbol config
The language server itself lives in ../src/Bosak.LanguageServer/ (C# / .NET 10).
Rebuild after server changes
dotnet build src/Bosak.LanguageServer/Bosak.LanguageServer.csproj
Then reload the VS Code Extension Development Host (Ctrl+R or Developer: Reload Window).
License
Dual Usage License — See the root LICENSE.md for details.
| |