XQuery + MarkLogic — VS Code Extension
XQuery 3.0/3.1 and MarkLogic 1.0-ml language support for Visual Studio Code.
The code base comes from the marklogic-intellij-plugin
by OverStory Ltd, itself based on Grzegorz Ligas' XQuery Support.
Features
| Feature |
Details |
| XQuery files |
.xq .xqi .xql .xqm .xqy .xqws .xquery |
| Syntax highlighting |
XQuery 3.1 and MarkLogic 1.0-ml, direct XML constructors with enclosed expressions, string constructors, xqDoc comments, annotations, pragmas |
| Completion |
3,810 built-in functions (MarkLogic 10 API plus W3C Functions and Operators 3.1), functions and variables of the file and of imported modules, namespace prefixes, keywords |
| Hover documentation |
Signature, summary, parameters, usage notes, examples and a link to the online documentation; xqDoc of your own functions |
| Signature help |
Active parameter while typing a call, triggered on ( and , |
| Go to definition |
Functions and variables, in the same file or in modules imported with import module ... at (relative or app-server-absolute locations, or by module namespace); import locations are links |
| Outline |
Module namespace, imports, namespace declarations, global variables and functions |
| Folding |
{ } blocks, comments and imports |
| Diagnostics |
Duplicate function declaration, unused import, unused namespace declaration, and optionally calls that assume the fn: namespace, with an Add fn: prefix quick fix |
| Snippets |
var, vvar, fun, ffun, ns, imp, mod, opt, let, for, order, group, some, switch, typeswitch, try, trace, ... |
| Commands |
MarkLogic: XQuery Function Doc Lookup (Ctrl+Shift+D in XQuery editors), MarkLogic 7–10 online docs, XQuery: New XQuery Main Module / Library Module |
The extension works on local files only and does not connect to a server.
Settings
| Setting |
Default |
|
marklogic.appserverRoot |
workspace folders |
Local directory that corresponds to the MarkLogic app server root. Absolute import locations (import module ... at "/lib/x.xqy") are resolved against it. ${workspaceFolder} is supported. |
marklogic.diagnostics.fnNamespaceAssumed |
false |
Report calls of built-in functions written without the fn: prefix. |
Development
npm install
npm test # unit tests (scanner, grammar)
VSCODE_EXECUTABLE=/path/to/Code npm run test:integration # runs the suite inside VS Code
node out/integration/runProject.js /path/to/xquery-project # read-only checks on a real project
npx @vscode/vsce package
data/functions.json holds the built-in function documentation, generated from the MarkLogic 10.0-3 API
documentation and the W3C XPath and XQuery Functions and Operators 3.1 recommendation. npm run build-data
regenerates it, together with snippets/ and syntaxes/ (see scripts/build-data.js).
License
Apache License 2.0. See LICENSE, NOTICE and CONTRIBUTORS.
| |