Rich XQuery editing support for Visual Studio Code, with full coverage of the
MarkLogic 1.0-ml dialect alongside W3C XQuery 3.0/3.1.
| Feature | Details |
|---|---|
| Syntax highlighting | Keywords, operators, strings, numbers, variables, XML literals, comments, annotations, pragmas |
| MarkLogic dialect | xquery version "1.0-ml", declare private function, xdmp:/cts:/sem:/json: namespaces |
| Code completion | Namespace-triggered (xdmp:, cts:, fn:…), variable scan, keyword and type completions |
| Hover documentation | Full signature, parameter table, return type, and "available since" for all built-in functions |
| Signature help | Active-parameter highlighting inside function argument lists, triggered on ( and , |
| Go to Definition | Ctrl+Click on local functions, variables, and import module … at "path" — resolves relative and server-absolute paths |
| Document Symbols | Outline panel and breadcrumb navigation for functions, variables, and namespace declarations |
| Diagnostics / Linting | Real-time and on-save checks for syntax errors, undeclared variables, unused declarations, deprecated functions, cross-file conflicts, and more |
| Code snippets | xqversion, module, import, fn, var, flwor, if, typeswitch, try, log, search, eval |
| Language configuration | XQuery block comments (: :), bracket matching, auto-close pairs |
.xq · .xqy · .xquery · .xqm · .xql
| Dialect | Version string |
|---|---|
| W3C XQuery 3.0 | xquery version "3.0" |
| W3C XQuery 3.1 | xquery version "3.1" |
| MarkLogic extended | xquery version "1.0-ml" |
- Open VS Code
- Press
Ctrl+P(orCmd+Pon macOS) - Run
ext install ppfjuni.marklogic-xquery-vscode-extension
- Download the latest
.vsixfrom the Releases page - In VS Code open the Command Palette (
Ctrl+Shift+P) - Run Extensions: Install from VSIX… and select the downloaded file
git clone https://github.com/marklogic-xquery/marklogic-xquery-vscode.git
cd marklogic-xquery-vscode
npm install
npm run build
# Then package the extension:
npx vsce packageInstall the generated .vsix via Extensions: Install from VSIX… as above.
Open any .xqy (or other supported extension) file — the extension activates automatically.
| Trigger | What you get |
|---|---|
Type xdmp: |
All xdmp: functions with snippet insertion |
Type cts: |
All cts: search functions |
Type fn: |
W3C standard fn: functions |
Type xs: |
All xs: constructor functions |
Type $ |
Variables declared above the cursor |
Type % |
XQuery 3.0 annotation names |
After as |
Built-in types (xs:string, item(), node()…) |
| Prefix | Expands to |
|---|---|
xqversion |
xquery version "1.0-ml"; |
module |
Module namespace declaration |
import |
Import module statement |
fn |
Declare function scaffold |
var |
Declare variable |
flwor |
Full FLWOR expression |
if |
If-then-else |
typeswitch |
Typeswitch with cases |
try |
Try-catch block |
log |
xdmp:log(…) |
search |
cts:search(…) |
eval |
xdmp:eval(…) |
- Ctrl+Click (or F12) on a local function call → jumps to its
declare function - Ctrl+Click on a
$variable→ jumps to itslet,for, ordeclare variablebinding - Ctrl+Click on a namespace prefix in
import module namespace pfx = … at "path.xqy"→ opens the target file if it exists in the workspace (supports both relative and server-absolute paths)
The extension runs a multi-phase linting engine automatically as you type and on save.
Real-time checks (debounced, 500 ms):
| Check | What it catches |
|---|---|
| Unclosed comment | Unmatched (: / :) |
| Unclosed string | Unclosed " or ' (handles doubled-delimiter escapes) |
| Unmatched brackets | Unmatched { } and ( ) |
| Unclosed XML element | Tags opened but never closed |
| Missing semicolon | Declaration or statement missing ; |
| Invalid version | Version string other than "1.0", "1.0-ml", "3.0", "3.1" |
| Variable before declaration | Using $var before it is declared |
| Duplicate functions | Same function declared twice in the same file |
| Unused declared variables | declare variable never referenced |
| Unused functions | declare function never called |
| Unused function parameters | Parameter declared but not used in its function body |
| Empty catch | catch block with no error handling |
| Deprecated functions | Calls to deprecated MarkLogic functions |
| Unused namespace declarations | declare namespace prefix never used |
| Namespace conflict | Conflicting declare default function namespace |
| Missing return type | declare function without an explicit return type |
| MarkLogic in standard mode | MarkLogic-specific constructs in a non-1.0-ml file |
| Unresolved variables | Reference to an undefined variable |
| Unresolved functions | Call to a function not declared or imported |
| Unresolved XML namespaces | XML element/attribute prefix not declared |
On-save checks (cross-file):
| Check | What it catches |
|---|---|
| Cross-file duplicate functions | Function name conflicts across imported modules |
| Cross-file unresolved functions | Calls to functions not found in any imported module |
This extension covers language editing only: syntax highlighting, completions, hover, signature help, go-to-definition, document symbols, diagnostics, and snippets.
The following are out of scope for this extension:
- Database connections and query execution
- Debugging
- Cross-file import resolution without a local
at "..."path
Not yet implemented:
- Code folding (planned)
- Fork the repository
npm install- Open in VS Code and press
F5to launch the Extension Development Host - Make changes, run
npm run compileto type-check,npm run buildto bundle - Submit a pull request
Apache 2.0 — see LICENSE and NOTICE.
This project is a derivative work of the marklogic-intellij-plugin by Grzegorz Ligas and contributors, also licensed under Apache 2.0.
"MarkLogic" is a registered trademark of Progress Software Corporation. This is an independent community project, not affiliated with or endorsed by Progress Software Corporation.