Code Intelligence for MoleculerJS — Go-to-Definition, CodeLens usage counts, and mixin-aware navigation for MoleculerJS microservice architectures.
VS Code treats service calls like ctx.call("v1.orders.create") as plain strings. CmdClick understands them as navigable symbols — Cmd+Click to jump to the action definition, see usage counts above every method, and trace calls across services and mixins.
⚠️ Alpha Release — This is an early version. Bugs are expected. If something doesn't navigate correctly, please open an issue — it helps a lot.
Click on any service action string to jump directly to its definition:
// Cmd+click on "create" → opens the action definition
await ctx.call("v1.orders.create", data);
// Also works with:
this.broker.call("v1.catalog.getItem", { id });
ctx.broker.call("v1.inventory.checkStock", itemId);
ctx.emit("order.created", payload);Every action and method shows a clickable usage count:
5 usages
async create(ctx) {
// ...
}
Click the label to open a peek panel with all call sites across the codebase.
Navigate from hook strings directly to the method definition:
hooks: {
before: {
publish: ["validateInput", "checkQuota"]
// ^ Cmd+click → goes to the method definition
}
}Navigate this.method() and chained calls, including local variable client calls:
const score = this.computeScore(data); // Cmd+click → definition
await this.catalogClient.fetchItems(params); // Cmd+click → class method definition
await notifyClient.sendAlert(params); // Cmd+click → local var methodCmdClick resolves MoleculerJS mixin chains. If validateInput is defined in a hooks mixin and mixed into multiple services, CmdClick:
- Navigates to the correct mixin file (not a random one)
- Shows usages from all consuming services
- Handles re-registered symbols across namespace boundaries
Click on the service name portion to navigate to the service file:
await ctx.call("v1.orders.create");
// ^ Click "orders" → opens the service fileClicking a definition with no callers shows a clear notification instead of failing silently:
CmdClick: No usages found for "processWebhook"
| Pattern | Action |
|---|---|
ctx.call("v1.service.action") |
Navigate to action definition |
this.broker.call("service.method") |
Navigate to method definition |
ctx.broker.call("service.method") |
Navigate to method definition |
ctx.emit("event.name") |
Navigate to event handler |
ctx.broadcast("event.name") |
Navigate to event handler |
this.methodName() |
Navigate to method in same service/mixin |
this.client.methodName() |
Navigate to class method definition |
localClient.methodName() |
Navigate to local variable client method |
hooks: { before: { action: ["method"] } } |
Navigate to method definition |
| Click on action/method definition | See all usages via CodeLens |
| Click on service name in string | Navigate to service file |
- On startup, CmdClick scans your workspace for
.jsfiles - Each file is parsed using acorn (a JavaScript AST parser — no regex)
- Actions, methods, hooks, and service calls are extracted and indexed in-memory
- Mixin chains are resolved so symbols can be found across service boundaries
- File changes are watched in real-time — edits are re-indexed automatically
Performance: Indexes 181 files in ~900ms, 22,856 symbols in under 2 seconds.
Tested against production MoleculerJS codebases:
| Repo | Symbols | References | Pass Rate |
|---|---|---|---|
| Service A (181 files) | 2,972 | 1,345 | 99.1% |
| Service B (476 files) | 22,856 | 6,511 | 99.7% |
Zero navigation failures across both repos.
| Setting | Default | Description |
|---|---|---|
cmdclick.enable |
true |
Enable/disable the CmdClick language server |
- VS Code 1.75.0 or later
- A MoleculerJS project with
.service.jsand/or.mixin.jsfiles
Search for CmdClick in the Extensions panel, or install via:
code --install-extension Anshuman115.cmdclickgit clone https://github.com/Anshuman115/CmdClick.git
cd CmdClick
make installThen reload VS Code (Cmd+Shift+P → "Reload Window").
Check the Output channel (View → Output → CmdClick) to confirm indexing.
# Unit tests
make test
# Automated integration test (generates test-report.html)
node auto-test.js --root=/path/to/your/project/src
# Live visual dashboard (streams results to browser)
node visual-test.js --root=/path/to/your/project/src --no-vscode- TypeScript (strict mode)
- Acorn — JavaScript AST parser
- Chokidar — file system watcher
- Mnemonist — radix trie for prefix search
- Hand-rolled JSON-RPC transport over stdio
Apache 2.0 © Anshuman Tripathy
