Your intelligent companion for MarkLogic development
MLCopilot brings AI-powered assistance to MarkLogic developers working with XQuery and XSLT, combining syntax highlighting, static analysis, intelligent code generation, and task management for MLCP and CoRB workflows.
Features
XQuery & XSLT Language Support
- Full XQuery syntax highlighting for
.xq,.xqy,.xquery,.xql,.xqmfiles - Full XSLT syntax highlighting for
.xsl,.xsltfiles - Theme-aware token colors (light and dark) for variables, functions, types, keywords, and operators
- Language Server Protocol (LSP) integration for real-time XQuery static error detection
Code Snippets
- XQuery snippets — version declaration, module namespace, imports, function/variable declarations, FLWOR expressions, and more
- XSLT snippets — stylesheet skeletons (2.0 and 3.0), templates,
xsl:for-each,xsl:if,xsl:choose, and more
MarkLogic Function IntelliSense
- Autocomplete — 3000+ MarkLogic built-in function completions with signatures and documentation, triggered by
:and- - Hover documentation — function signature, parameters, return type, and examples on hover
AI-Powered Features
Natural Language to XQuery
- Command:
MLCopilot: Natural Language to XQuery - Key:
Ctrl+Shift+X/Cmd+Shift+X - Describe your intent in plain English; AI generates optimized XQuery code
- Output includes a copy-to-clipboard button in the side panel
Explain Selected XQuery Code
- Command:
MLCopilot: Explain Selected XQuery Code - Key:
Ctrl+Shift+E/Cmd+Shift+E(requires selection) - Context menu: Right-click on selected XQuery → "Explain Selected XQuery Code"
- AI explains selected code with constructs, purpose, and gotchas in a side panel
Hover Error Explanation
- Hover over a syntax error in XQuery to get an AI-generated explanation and fix suggestion
MLCP Task Generator
- Command:
MLCopilot: Generate MLCP Task - Key:
Ctrl+Shift+M/Cmd+Shift+M(inbuild.gradle) - Context menu: Right-click in
build.gradle→ "Generate MLCP Task" - Interactively generates MarkLogic Content Pump (MLCP) Gradle task definitions
- Supported task types: CSV Import, TSV Import, JSON Import, XML Import, Export
- Prompts for task name, database, collection, and generates full configuration with batch size, thread count, and transaction size
CoRB Task Generator
- Command:
MLCopilot: Generate CoRB Task - Key:
Ctrl+Shift+C/Cmd+Shift+C(inbuild.gradle) - Context menu: Right-click in
build.gradle→ "Generate CoRB Task" - Interactively generates Content on Request (CoRB) Gradle task definitions
- Prompts for task name, URIs type (module-based or file-based), thread count, and optional export file
MLCP & CoRB IntelliSense in build.gradle
- MLCP autocomplete — property completions for IMPORT, EXPORT, and COPY commands, triggered by
=and space - MLCP hover — property description, type, valid values, examples, and applicable commands
- CoRB autocomplete — property completions inside CoRB task blocks, with category, type, and examples
- CoRB hover — property documentation on hover
Query Editor
- Command:
MLCopilot: Open Query Editor - Dedicated MLCopilot Query Activity Bar panel — clicking the icon now instantly opens the Query Editor without a separate button
- Query Type selector — run queries as XQuery, JavaScript, SQL, or SPARQL against the MarkLogic REST API
- Run shortcut:
F5orCtrl+Enter— select text first to run only the selection - Refresh Databases button next to the Databases section for on-demand database list reload
- Copy URI hover button in the document explorer for one-click URI copying
- Complements the Tasks Panel — write ad-hoc queries without leaving VS Code
Multi-Workspace Query Management
- Workspace menu in the Queries rail — switch, create, clone, and delete named workspaces
- Export Workspace — saves all workspaces and their queries to an XML file (preserves query mode and tab order)
- Import Workspace — restores workspaces from XML (multi-workspace) or legacy JSON format
- Each workspace maintains its own set of queries and active query state
Tasks Panel
- Sidebar: Activity bar icon opens "MLCopilot Tasks" panel
- Auto-scans workspace
build.gradlefiles to list all MLCP and CoRB tasks - Shows tasks in organized tables with MLCP/CoRB type badges
- One-click DEV and PROD or LOCAL run buttons that spawn a terminal
- Real-time running status with animation; prevents duplicate executions
- Refresh command:
MLCopilot: Refresh Tasks(refresh icon in panel title)
XSLT IntelliSense
- XSLT element completions — type
xsl:in any.xsl/.xsltfile to get snippet completions for all 35+ standard XSLT 2.0 elements (xsl:template,xsl:for-each,xsl:choose,xsl:result-document,xsl:analyze-string, and more) - Completions also work inside embedded
<xsl:stylesheet>…</xsl:stylesheet>blocks within XQuery (.xqy) files - Each completion includes a description and tab-stop snippet placeholders
- MarkLogic function IntelliSense (3000+ completions) is now also active in pure XSLT files
XML Developer Tools
- XPath 3.1 Evaluator: Open a dedicated webview to query your active XML document using a full SaxonJS-powered XPath 3.1 engine. Includes namespace support, syntax-highlighted node previews, and click-to-copy results.
- Formatting Utilities: 1-click Beautify to format poorly spaced/minified XML (intelligently preserving inline text), or Minify to strip structural whitespace for payload compression.
- Document Analysis: Check the active document for Well-formedness errors (mismatched/unclosed tags) directly in the Output panel, or instantly grab the XPath of your current cursor position.
XQuery Static Analysis Improvements
- User-defined function argument checking — the validator now reports argument-count mismatches for calls to functions declared in the same file or in imported library modules
- Imported module files are resolved from
import module … at "…"declarations — supports relative paths and absolute URI-style paths (e.g.,/project/lib.xqy) - Embedded XSLT false positive fix — XQuery files containing embedded
<xsl:stylesheet>blocks no longer generate spurious warnings aboutxsl:namespace prefixes or undefined variables
Go to Definition
- Command:
MLCopilot: definition - Context menu: Right-click in any XQuery file → "mlcopilot: definition"
- Navigates to the definition of the function or variable under the cursor within the workspace
- Supports user-defined functions across XQuery module files
Find All References
- Command:
MLCopilot: FindAllReferences - Context menu: Right-click in any XQuery file → "mlcopilot: FindAllReferences"
- Lists every reference to the symbol under the cursor across the workspace in the References panel
Run on MarkLogic
- Command:
MLCopilot: Run on MarkLogic - Context menu (Explorer): Right-click any
.xqyfile → "Run on MarkLogic" - Context menu (Editor): Right-click inside an open XQuery file → "Run on MarkLogic"
- Executes the XQuery file directly against a configured MarkLogic server and displays results in the output panel
Multi-Provider AI Support
- Command:
MLCopilot: Switch AI Provider - Switch between AI providers at any time via quick pick:
- Auto — tries Claude Code → ChatGPT → Gemini automatically
- Claude Code — free, no API key needed (uses the Claude Code VS Code extension)
- ChatGPT — OpenAI API (requires
mlcopilot.openai.apiKey) - Gemini — Google Gemini API (free tier available, requires
mlcopilot.gemini.apiKey)
Installation
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X) - Search for "MLCopilot"
- Click Install
Getting Started
- Open any
.xqyor.xslfile — syntax highlighting and IntelliSense work automatically - Errors appear in the Problems panel via the XQuery language server
- For AI features, configure your provider in settings (see below)
Extension Settings
| Setting | Default | Description |
|---|---|---|
mlcopilot.provider |
auto |
AI provider: auto, claude-code, chatgpt, gemini |
mlcopilot.openai.apiKey |
"" |
OpenAI API key for ChatGPT provider |
mlcopilot.openai.model |
gpt-4o |
ChatGPT model: gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-3.5-turbo |
mlcopilot.gemini.apiKey |
"" |
Google Gemini API key |
mlcopilot.gemini.model |
gemini-2.0-flash |
Gemini model: gemini-2.0-flash, gemini-1.5-pro, gemini-1.5-flash |
mlcopilot.username |
set user name for gradle task | |
mlcopilot.password |
set password for gradle task |
Commands & Keyboard Shortcuts
| Command | Key (Win/Linux) | Key (Mac) | Context |
|---|---|---|---|
| Natural Language to XQuery | Ctrl+Shift+X |
Cmd+Shift+X |
Any XQuery file |
| Explain Selected XQuery Code | Ctrl+Shift+E |
Cmd+Shift+E |
XQuery file with selection |
| Generate MLCP Task | Ctrl+Shift+M |
Cmd+Shift+M |
build.gradle |
| Generate CoRB Task | Ctrl+Shift+C |
Cmd+Shift+C |
build.gradle |
| Go to Definition | — | — | XQuery file (context menu) |
| Find All References | — | — | XQuery file (context menu) |
| Run on MarkLogic | — | — | XQuery file (editor & explorer context menu) |
| Open Query Editor | — | — | Activity Bar / Command Palette |
| Switch AI Provider | — | — | Command Palette |
| Refresh Tasks | — | — | Tasks Panel title bar |
| Open XPath 3.1 Evaluator | MLCopilot: Open XPath Evaluator |
Active XML File | |
| Check XML Well-formedness | MLCopilot: Check XML Well-formedness |
Active XML File | |
| Beautify XML | MLCopilot: Beautify XML |
Active XML File | |
| Minify XML | MLCopilot: Minify XML |
Active XML File | |
| Get Path at Cursor | MLCopilot: Get XML Path at Cursor |
Active XML File |
Requirements
- VS Code 1.115.0 or higher
- (Optional) API key for ChatGPT or Gemini if not using Claude Code
Known Issues
- Static analysis currently supports XQuery 1.0-ml
- XSLT error detection is limited to syntax validation
Roadmap
- Enhanced XSLT support
- Code completion for MarkLogic server-side modules
- Integration with MarkLogic server for live validation
- Snippet library for common patterns
Contributing
Found a bug or have a feature request? Open an issue on GitHub.
License
MIT License — see LICENSE file for details.
Author
Akbar Ali
Senior MarkLogic Developer | MarkLogic Certified (v10, v12)