Skip to content

Commit f8a7a4f

Browse files
reidspencerclaude
andcommitted
Integrate all providers and register MCP commands in extension
Integration: - Register FoldingRangeProvider for code folding - Register DocumentSymbolProvider for outline/breadcrumbs - Register CodeActionsProvider with MCP-backed actions - Initialize MCP service with auto-connect - Register 7 MCP tool commands in command palette - Add MCP configuration settings (serverUrl, apiKey, enabled, autoConnect) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9e794f5 commit f8a7a4f

3 files changed

Lines changed: 212 additions & 6 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,69 @@
8686
{
8787
"command": "riddl.translate",
8888
"title": "RIDDL: Translate to Output Format"
89+
},
90+
{
91+
"command": "riddl.mcp.toggleConnection",
92+
"title": "RIDDL MCP: Toggle Connection"
93+
},
94+
{
95+
"command": "riddl.mcp.showOutput",
96+
"title": "RIDDL MCP: Show Output"
97+
},
98+
{
99+
"command": "riddl.mcp.validate",
100+
"title": "RIDDL MCP: Validate Current File"
101+
},
102+
{
103+
"command": "riddl.mcp.validatePartial",
104+
"title": "RIDDL MCP: Validate Partial Model"
105+
},
106+
{
107+
"command": "riddl.mcp.checkCompleteness",
108+
"title": "RIDDL MCP: Check Completeness"
109+
},
110+
{
111+
"command": "riddl.mcp.checkSimulability",
112+
"title": "RIDDL MCP: Check Simulability"
113+
},
114+
{
115+
"command": "riddl.mcp.explainError",
116+
"title": "RIDDL MCP: Explain Error"
117+
},
118+
{
119+
"command": "riddl.mcp.suggestNext",
120+
"title": "RIDDL MCP: Suggest Next Steps"
121+
},
122+
{
123+
"command": "riddl.mcp.generateRiddl",
124+
"title": "RIDDL MCP: Generate RIDDL from Description"
125+
}
126+
],
127+
"configuration": {
128+
"title": "RIDDL",
129+
"properties": {
130+
"riddl.mcp.enabled": {
131+
"type": "boolean",
132+
"default": true,
133+
"description": "Enable MCP server integration for AI-assisted features"
134+
},
135+
"riddl.mcp.serverUrl": {
136+
"type": "string",
137+
"default": "http://localhost:8080",
138+
"description": "URL of the RIDDL MCP server"
139+
},
140+
"riddl.mcp.apiKey": {
141+
"type": "string",
142+
"default": "",
143+
"description": "API key for MCP server authentication (optional)"
144+
},
145+
"riddl.mcp.autoConnect": {
146+
"type": "boolean",
147+
"default": true,
148+
"description": "Automatically connect to MCP server when opening RIDDL files"
149+
}
89150
}
90-
]
151+
}
91152
},
92153
"scripts": {
93154
"vscode:prepublish": "npm run compile",
@@ -113,6 +174,6 @@
113174
"typescript": "^4.9.5"
114175
},
115176
"dependencies": {
116-
"@ossuminc/riddl-lib": "file:../riddl/npm-packages/ossuminc-riddl-lib-1.0.1-14-54379e2e-20260109-2100.tgz"
177+
"@ossuminc/riddl-lib": "file:../riddl/npm-packages/ossuminc-riddl-lib-1.1.1-1-7bc49bb2-20260120-1709.tgz"
117178
}
118179
}

src/extension.ts

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@ import { RiddlDiagnosticsProvider } from './diagnosticsProvider';
55
import { RiddlCompletionProvider } from './completionProvider';
66
import { RiddlDefinitionProvider } from './definitionProvider';
77
import { RiddlReferenceProvider } from './referenceProvider';
8+
import { RiddlCodeActionsProvider, registerCodeActionCommands } from './codeActionsProvider';
9+
import { RiddlFoldingRangeProvider } from './foldingProvider';
10+
import { RiddlDocumentSymbolProvider } from './documentSymbolProvider';
811
import * as commands from './commands';
12+
import {
13+
getMcpService,
14+
disposeMcpService,
15+
mcpValidate,
16+
mcpValidatePartial,
17+
mcpCheckCompleteness,
18+
mcpCheckSimulability,
19+
mcpExplainError,
20+
mcpSuggestNext,
21+
mcpGenerateRiddl,
22+
} from './mcp';
923

1024
/**
1125
* RIDDL VSCode Extension
@@ -16,6 +30,12 @@ import * as commands from './commands';
1630
* Milestone 4: Hover provider for documentation
1731
* Milestone 5: Diagnostics provider for parse and validation errors
1832
* Milestone 6: Code intelligence (completion, definitions, references)
33+
* Milestone 7: Commands (info, parse, validate, translate)
34+
* Milestone 9: MCP client infrastructure for AI-assisted features
35+
* Milestone 10: MCP commands for AI tools
36+
* Milestone 11: Code actions (light bulb) for AI-assisted development
37+
* Milestone 12: Code folding for definitions and comments
38+
* Milestone 13: Document outline and breadcrumb navigation
1939
*
2040
* This extension provides language support for RIDDL (Reactive Interface to Domain Definition Language),
2141
* a specification language for designing distributed, reactive, cloud-native systems using DDD principles.
@@ -131,6 +151,49 @@ export function activate(context: vscode.ExtensionContext) {
131151
);
132152
console.log('RIDDL reference provider registered');
133153

154+
// Register code actions provider for AI-assisted suggestions
155+
console.log('Creating code actions provider...');
156+
const codeActionsProvider = new RiddlCodeActionsProvider();
157+
console.log('Registering code actions provider...');
158+
context.subscriptions.push(
159+
vscode.languages.registerCodeActionsProvider(
160+
selector,
161+
codeActionsProvider,
162+
{
163+
providedCodeActionKinds: RiddlCodeActionsProvider.providedCodeActionKinds,
164+
}
165+
)
166+
);
167+
console.log('RIDDL code actions provider registered');
168+
169+
// Register code action commands
170+
registerCodeActionCommands(context);
171+
console.log('RIDDL code action commands registered');
172+
173+
// Register folding range provider for code folding
174+
console.log('Creating folding range provider...');
175+
const foldingProvider = new RiddlFoldingRangeProvider();
176+
console.log('Registering folding range provider...');
177+
context.subscriptions.push(
178+
vscode.languages.registerFoldingRangeProvider(
179+
selector,
180+
foldingProvider
181+
)
182+
);
183+
console.log('RIDDL folding range provider registered');
184+
185+
// Register document symbol provider for outline and breadcrumbs
186+
console.log('Creating document symbol provider...');
187+
const documentSymbolProvider = new RiddlDocumentSymbolProvider();
188+
console.log('Registering document symbol provider...');
189+
context.subscriptions.push(
190+
vscode.languages.registerDocumentSymbolProvider(
191+
selector,
192+
documentSymbolProvider
193+
)
194+
);
195+
console.log('RIDDL document symbol provider registered');
196+
134197
} catch (error) {
135198
console.error('Error during extension activation:', error);
136199
if (error instanceof Error) {
@@ -179,9 +242,91 @@ export function activate(context: vscode.ExtensionContext) {
179242
);
180243

181244
console.log('RIDDL commands registered');
245+
246+
// Initialize MCP service for AI-assisted features
247+
console.log('Initializing MCP service...');
248+
const mcpService = getMcpService();
249+
context.subscriptions.push(mcpService);
250+
251+
// Register MCP commands
252+
context.subscriptions.push(
253+
vscode.commands.registerCommand('riddl.mcp.toggleConnection', () => {
254+
mcpService.toggleConnection();
255+
})
256+
);
257+
258+
context.subscriptions.push(
259+
vscode.commands.registerCommand('riddl.mcp.showOutput', () => {
260+
mcpService.showOutput();
261+
})
262+
);
263+
264+
// Register MCP tool commands
265+
context.subscriptions.push(
266+
vscode.commands.registerCommand('riddl.mcp.validate', () => {
267+
mcpValidate();
268+
})
269+
);
270+
271+
context.subscriptions.push(
272+
vscode.commands.registerCommand('riddl.mcp.validatePartial', () => {
273+
mcpValidatePartial();
274+
})
275+
);
276+
277+
context.subscriptions.push(
278+
vscode.commands.registerCommand('riddl.mcp.checkCompleteness', () => {
279+
mcpCheckCompleteness();
280+
})
281+
);
282+
283+
context.subscriptions.push(
284+
vscode.commands.registerCommand('riddl.mcp.checkSimulability', () => {
285+
mcpCheckSimulability();
286+
})
287+
);
288+
289+
context.subscriptions.push(
290+
vscode.commands.registerCommand('riddl.mcp.explainError', () => {
291+
mcpExplainError();
292+
})
293+
);
294+
295+
context.subscriptions.push(
296+
vscode.commands.registerCommand('riddl.mcp.suggestNext', () => {
297+
mcpSuggestNext();
298+
})
299+
);
300+
301+
context.subscriptions.push(
302+
vscode.commands.registerCommand('riddl.mcp.generateRiddl', () => {
303+
mcpGenerateRiddl();
304+
})
305+
);
306+
307+
console.log('MCP tool commands registered');
308+
309+
// Auto-connect to MCP server if enabled
310+
const mcpConfig = mcpService.getConfig();
311+
if (mcpConfig.enabled && mcpConfig.autoConnect) {
312+
// Delay auto-connect to allow extension to fully activate
313+
setTimeout(() => {
314+
console.log('Auto-connecting to MCP server...');
315+
mcpService.connect().then((result) => {
316+
if (result.success) {
317+
console.log('MCP auto-connect successful');
318+
} else {
319+
console.log('MCP auto-connect failed:', result.error);
320+
}
321+
});
322+
}, 1000);
323+
}
324+
325+
console.log('MCP service initialized');
182326
}
183327

184328
export function deactivate() {
185329
console.log('RIDDL extension is now deactivated');
186330
commands.disposeCommands();
331+
disposeMcpService();
187332
}

0 commit comments

Comments
 (0)