feat: add vscode support and publish new version#481
Conversation
Introduce new classes for tracking, summarizing, and displaying file changes in the IDEA toolwindow, and update input area to integrate with these features.
Integrate PlanStateService observation to update renderer with current plan. Add logging for plan updates and summary rendering.
Update the plan instance with a new timestamp to ensure StateFlow emits changes when task or step status is updated.
- Add observePlanState method to JsCodingAgent for observing PlanStateService state changes - Extend JsPlanSummaryData with JsTaskSummary and JsStepSummary for complete task/step info - Add plan state observer in ChatViewProvider to sync plan updates to webview - Add planUpdate/planCleared message handling in App.tsx - Pass currentPlan prop to ChatInput component for PlanSummaryBar display - Add ws as external dependency in esbuild config
- Add error handling for plan markdown parsing in JewelRenderer - Restore OutputDisplay in IdeaTerminalRenderer (was commented out) - Fix root-level files edge case in IdeaFileChangeItem - Cancel planStateObserverJob in IdeaAgentViewModel.dispose() - Add dispose() method to ChatViewProvider for cleanup - Add type guard validation for PlanData in App.tsx - Replace println with Logger in IdeaFileChangeSummary - Simplify StateFlow update in PlanStateService (use direct reassignment)
feat(vscode): implement plan functionality for mpp-vscode
Integrate PlanStateService observation to update renderer with current plan. Add logging for plan updates and summary rendering.
- Remove assistant message background for unified look - Add DevInRenderer to parse and display devin blocks as tool calls - Filter <devin> tags from markdown content - Add open file button for read-file tool - Hide Task completed message (implicit from response)
- Remove unnecessary 'g' flag from regex for unclosed devin tags - Make standalone </devin> removal more conservative (only on own line) - Add aria-label attributes for accessibility - Only show pointer cursor when header is clickable (has params) - Document limitation: parser does not handle escaped quotes
- Remove redundant trim() call in MarkdownRenderer (filterDevinTags already trims) - Optimize useMemo in DevInRenderer to skip parsing during streaming
feat(vscode): improve renderer UI for better UX
Remove file path from toolName and use only displayName for clarity.
Use project.basePath for process execution and set terminal output bubble to collapsed by default.
Display tool output in the timeline bubble header, truncating with ellipsis and falling back to params if output is unavailable. UI now handles overflow without fixed truncation.
fix(idea): use correct project basePath for shell execution and improve tool call bubble UI
…ce parsing ## CodeLens Implementation - Add Tree-sitter based code element parser (code-element-parser.ts) - Support 7 languages: TypeScript, JavaScript, Python, Java, Kotlin, Go, Rust - Implement AutoComment, AutoTest, AutoMethod actions - Add prompt templates for code generation ## CodeFence Fix - Rewrite codeFence.ts to match mpp-core's CodeFence.parseAll logic - Add preProcessDevinBlock to convert ```devin blocks to <devin> tags - Handle <devin>, <thinking>, and <!-- walkthrough_start --> tags - Fix issue where devin instructions showed extra CodeBlockRenderer ## Other Changes - Remove auto-add current file feature from ChatInput - Add getCurrentModelConfig to ChatViewProvider for CodeLens actions - Add web-tree-sitter and @unit-mesh/treesitter-artifacts dependencies
Eliminates duplicate DevIn rendering, tool rerun button, and timeline item headers for a cleaner UI and improved code structure.
- Add missing autodev.codelens.showMenu command declaration - Remove unsupported languages (csharp, cpp, c) from CodeLens registration - Fix Python test file naming to use consistent test_*.py format - Implement robust WASM file bundling and path resolution - Add copy-wasm.js script to copy WASM files during build - Update build script to include web-tree-sitter external and copy:wasm - Implement multi-strategy path resolution (extension path + node_modules fallback) - Add .vscodeignore to ensure WASM files are packaged
Update mppVersion in gradle.properties and add new media assets and backup files for the upcoming release.
feat(mpp-vscode): implement CodeLens with Tree-sitter and fix CodeFence parsing
…iles - Update .vscodeignore to exclude parent directories - Add *.vsix to .gitignore to avoid committing large binary files
|
Caution Review failedThe pull request is closed. WalkthroughThis PR introduces plan state observability across the platform (CodingAgent and PlanStateService), adds file change tracking and UI components to the IDEA plugin, expands the VSCode extension with CodeLens actions (AutoComment, AutoTest, AutoMethod) backed by tree-sitter code parsing, and updates version to 0.3.4. Changes
Sequence Diagram(s)sequenceDiagram
participant IdeaAgentViewModel as IdeaAgentViewModel
participant CodingAgent as CodingAgent
participant PlanStateService as PlanStateService
participant JewelRenderer as JewelRenderer
participant UI as IDEA UI
IdeaAgentViewModel->>CodingAgent: initializeCodingAgent()
IdeaAgentViewModel->>IdeaAgentViewModel: startPlanStateObserver()
IdeaAgentViewModel->>PlanStateService: subscribe to currentPlan
Note over CodingAgent,PlanStateService: Agent executes plan
CodingAgent->>PlanStateService: updateStatus()/completeStep()
PlanStateService->>PlanStateService: mutate plan data
PlanStateService->>PlanStateService: _currentPlan.value = plan<br/>(reassign to trigger emission)
PlanStateService->>IdeaAgentViewModel: emit plan update
IdeaAgentViewModel->>JewelRenderer: setPlan(plan)
JewelRenderer->>UI: render plan with steps/tasks
UI->>IdeaAgentViewModel: user interacts with changes
IdeaAgentViewModel->>IdeaFileChangeTracker: process file changes
sequenceDiagram
participant VFS as IntelliJ VFS
participant IdeaFileChangeTracker as IdeaFileChangeTracker
participant FileChangeTracker as FileChangeTracker
participant IdeaFileChangeSummary as IdeaFileChangeSummary
participant IdeaFileChangeDiffDialog as Diff Dialog
VFS->>IdeaFileChangeTracker: bulk file change events
IdeaFileChangeTracker->>IdeaFileChangeTracker: cache original content
IdeaFileChangeTracker->>FileChangeTracker: recordChange(path, type, content)
FileChangeTracker->>IdeaFileChangeSummary: emit changes
IdeaFileChangeSummary->>IdeaFileChangeSummary: render changes list
Note over IdeaFileChangeSummary,IdeaFileChangeDiffDialog: User action
IdeaFileChangeSummary->>IdeaFileChangeDiffDialog: show(change)
IdeaFileChangeDiffDialog->>IdeaFileChangeDiffDialog: renderDiffView()
alt User clicks Undo
IdeaFileChangeDiffDialog->>IdeaFileChangeTracker: rollback(change)
IdeaFileChangeTracker->>VFS: restore file
else User clicks Keep
IdeaFileChangeDiffDialog->>FileChangeTracker: removeChange()
end
sequenceDiagram
participant Editor as VSCode Editor
participant CodeLensProvider as AutoDevCodeLensProvider
participant CodeElementParser as CodeElementParser
participant TreeSitter as Tree-sitter
participant CodelensCommands as CodeLensCommands
participant AutoAction as Auto-action (Comment/Test/Method)
participant LLMService as LLMService
Editor->>CodeLensProvider: provideCodeLenses(document)
CodeLensProvider->>CodeElementParser: parse(document)
CodeElementParser->>TreeSitter: load language & parse tree
TreeSitter-->>CodeElementParser: extract methods/classes
CodeElementParser-->>CodeLensProvider: CodeElement[]
CodeLensProvider->>CodeLensProvider: create CodeLens per action
CodeLensProvider-->>Editor: render action buttons
Note over Editor,LLMService: User clicks CodeLens action
Editor->>CodelensCommands: onCommand (e.g., autoComment)
CodelensCommands->>AutoAction: executeAutoComment(context)
AutoAction->>LLMService: streamLLM(prompt)
LLMService-->>AutoAction: response stream
AutoAction->>AutoAction: parse response code block
AutoAction->>Editor: applyDiff(changes)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (4)
📒 Files selected for processing (49)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive VSCode extension support for the AutoDev KMP (Kotlin Multiplatform) Edition, along with version 0.5.3 publish preparation. The changes establish a full-featured AI coding assistant with CodeLens, chat interface, and agent capabilities.
Key Changes
- CodeLens Infrastructure: New Tree-sitter-based code parsing for 8 languages with inline AI actions (Quick Chat, Explain, Optimize, AutoComment, AutoTest, AutoMethod)
- Webview Enhancements: Improved markdown rendering, DevIn block handling, plan summary display, and UI refinements with better spacing/margins
- Agent System Updates: Plan state observability via new
observePlanState()method, file change tracking, and improved state synchronization between mpp-core and UI layers
Reviewed changes
Copilot reviewed 49 out of 53 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| mpp-vscode/package.json | Version bump to 0.5.3, added dependencies (web-tree-sitter, treesitter-artifacts), new CodeLens commands and configuration |
| mpp-vscode/src/providers/codelens-provider.ts | New CodeLens provider with language-specific parsing and action display |
| mpp-vscode/src/providers/code-element-parser.ts | Tree-sitter AST parser with regex fallback for 8 languages |
| mpp-vscode/src/prompts/prompt-templates.ts | Template generation for AutoDoc, AutoTest, AutoMethod actions |
| mpp-vscode/src/commands/codelens-commands.ts | Command handlers for all CodeLens actions |
| mpp-vscode/src/actions/auto-actions.ts | Action executors for AutoComment, AutoTest, AutoMethod with LLM integration |
| mpp-vscode/webview/src/utils/codeFence.ts | Enhanced markdown code fence parser supporting devin blocks, thinking tags, walkthrough comments |
| mpp-vscode/webview/src/components/sketch/* | New DevInRenderer, improved MarkdownRenderer with devin tag filtering, updated styling |
| mpp-vscode/webview/src/App.tsx | Plan state integration, increased max iterations (10→100), removed auto-add file feature |
| mpp-core/src/jsMain/kotlin/cc/unitmesh/agent/* | New observePlanState() method, enhanced plan summary exports with tasks/steps |
| mpp-idea/src/main/kotlin/cc/unitmesh/devins/idea/toolwindow/* | File change tracking system, plan summary bar improvements, terminal output collapse by default |
| README.md | Complete rewrite with KMP branding, feature documentation, architecture details |
| scripts/copy-wasm.js | WASM file deployment script for Tree-sitter grammars |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| // Sort by position | ||
| tagMatches.sort((a, b) => a.match.index - b.match.index); |
There was a problem hiding this comment.
The sort operation may be unstable for ties. Since a.match.index - b.match.index is used, identical indices (unlikely but possible) won't have a defined order. Consider adding a secondary sort key if tag order matters when indices are equal.
|
|
||
| // Parse key="value" or key=value patterns | ||
| // Note: Does not handle escaped quotes within quoted values | ||
| const paramRegex = /([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|(\S+))/g; |
There was a problem hiding this comment.
The parser does not handle escaped quotes within quoted values as noted in the comment on lines 26-27. This could lead to incorrect parameter parsing for values like key="value with \"escaped\"". Consider using a more robust parser or documenting this limitation in user-facing documentation.
| "build": "npm run build:extension && npm run build:webview", | ||
| "build:extension": "esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --format=cjs --platform=node", | ||
| "build": "npm run build:extension && npm run build:webview && npm run copy:wasm", | ||
| "build:extension": "esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --external:ws --external:web-tree-sitter --format=cjs --platform=node", |
There was a problem hiding this comment.
[nitpick] The external bundle exclusions --external:ws --external:web-tree-sitter should be documented in a README or configuration file explaining why these packages need to be excluded from the bundle. This helps future maintainers understand the build requirements.
| isProcessing: false, | ||
| currentIteration: 0, | ||
| maxIterations: 10, | ||
| maxIterations: 100, |
There was a problem hiding this comment.
The maxIterations value changed from 10 to 100. This is a significant increase (10x) that could impact performance and costs for LLM API calls. Consider adding configuration validation or user warnings if this high iteration count is reached, as it might indicate an infinite loop or inefficient task.
Summary by CodeRabbit
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.