forked from phodal/auto-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
feat(mpp-vscode): implement CodeLens with Tree-sitter and fix CodeFence parsing #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b34a64d
feat(mpp-vscode): implement CodeLens with Tree-sitter and fix CodeFen…
phodal 2a39530
refactor(ui): remove redundant tool rerun and timeline header
phodal b047e4f
fix(mpp-vscode): address PR #43 review comments
phodal 254e488
chore(release): bump mppVersion to 0.3.4
phodal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # VSCode extension ignore file | ||
| # Exclude source files and build artifacts not needed in the packaged extension | ||
|
|
||
| # Source files | ||
| src/ | ||
| webview/src/ | ||
| webview/node_modules/ | ||
|
|
||
| # Build artifacts | ||
| *.map | ||
| tsconfig.json | ||
| .eslintrc.json | ||
|
|
||
| # Development files | ||
| .vscode/ | ||
| node_modules/ | ||
| .gitignore | ||
| .git/ | ||
|
|
||
| # Test files | ||
| **/__tests__/** | ||
| **/*.test.* | ||
| **/*.spec.* | ||
|
|
||
| # Documentation | ||
| README.md | ||
| CHANGELOG.md | ||
|
|
||
| # Keep dist and wasm folders | ||
| !dist/ | ||
| !wasm/ | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,34 @@ | |
| { | ||
| "command": "autodev.runAgent", | ||
| "title": "AutoDev: Run Coding Agent" | ||
| }, | ||
| { | ||
| "command": "autodev.codelens.quickChat", | ||
| "title": "AutoDev: Quick Chat" | ||
| }, | ||
| { | ||
| "command": "autodev.codelens.explainCode", | ||
| "title": "AutoDev: Explain Code" | ||
| }, | ||
| { | ||
| "command": "autodev.codelens.optimizeCode", | ||
| "title": "AutoDev: Optimize Code" | ||
| }, | ||
| { | ||
| "command": "autodev.codelens.autoComment", | ||
| "title": "AutoDev: Auto Comment" | ||
| }, | ||
| { | ||
| "command": "autodev.codelens.autoTest", | ||
| "title": "AutoDev: Auto Test" | ||
| }, | ||
| { | ||
| "command": "autodev.codelens.autoMethod", | ||
| "title": "AutoDev: Auto Method" | ||
| }, | ||
| { | ||
| "command": "autodev.codelens.showMenu", | ||
| "title": "AutoDev: Show CodeLens Menu" | ||
| } | ||
| ], | ||
| "viewsContainers": { | ||
|
|
@@ -99,6 +127,44 @@ | |
| "type": "number", | ||
| "default": 23120, | ||
| "description": "Port for the IDE server (MCP protocol)" | ||
| }, | ||
| "autodev.codelens.enable": { | ||
| "type": "boolean", | ||
| "default": true, | ||
| "description": "Enable CodeLens to show AI actions above functions and classes" | ||
| }, | ||
| "autodev.codelens.displayMode": { | ||
| "type": "string", | ||
| "default": "expand", | ||
| "enum": [ | ||
| "expand", | ||
| "collapse" | ||
| ], | ||
| "enumDescriptions": [ | ||
| "Show all actions separately", | ||
| "Show a collapsed menu" | ||
| ], | ||
| "description": "CodeLens display mode" | ||
| }, | ||
| "autodev.codelens.items": { | ||
| "type": "array", | ||
| "default": [ | ||
| "quickChat", | ||
| "autoTest", | ||
| "autoComment" | ||
| ], | ||
| "items": { | ||
| "type": "string", | ||
| "enum": [ | ||
| "quickChat", | ||
| "explainCode", | ||
| "optimizeCode", | ||
| "autoComment", | ||
| "autoTest", | ||
| "autoMethod" | ||
| ] | ||
| }, | ||
| "description": "CodeLens items to display" | ||
| } | ||
| } | ||
| }, | ||
|
|
@@ -137,9 +203,10 @@ | |
| }, | ||
| "scripts": { | ||
| "vscode:prepublish": "npm run build", | ||
| "build": "npm run build:extension && npm run build:webview", | ||
| "build:extension": "esbuild ./src/extension.ts --bundle --outfile=dist/extension.js --external:vscode --external:ws --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", | ||
| "build:webview": "cd webview && npm install && npm run build", | ||
| "copy:wasm": "node scripts/copy-wasm.js", | ||
| "watch": "npm run build:extension -- --watch", | ||
| "package": "vsce package", | ||
| "lint": "eslint src --ext ts", | ||
|
|
@@ -162,8 +229,10 @@ | |
| "dependencies": { | ||
| "@autodev/mpp-core": "file:../mpp-core/build/packages/js", | ||
| "@modelcontextprotocol/sdk": "^1.0.0", | ||
| "@unit-mesh/treesitter-artifacts": "^1.7.7", | ||
| "cors": "^2.8.5", | ||
| "express": "^4.18.2", | ||
| "web-tree-sitter": "^0.25.10", | ||
|
Comment on lines
+258
to
+261
|
||
| "yaml": "^2.8.2", | ||
| "zod": "^3.22.4" | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| #!/usr/bin/env node | ||
| /** | ||
| * Copy WASM files from @unit-mesh/treesitter-artifacts to dist/wasm | ||
| */ | ||
|
|
||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| const sourceDir = path.join(__dirname, '../node_modules/@unit-mesh/treesitter-artifacts/wasm'); | ||
| const targetDir = path.join(__dirname, '../dist/wasm'); | ||
|
|
||
| // Create target directory if it doesn't exist | ||
| if (!fs.existsSync(targetDir)) { | ||
| fs.mkdirSync(targetDir, { recursive: true }); | ||
| } | ||
|
|
||
| // List of required WASM files | ||
| const wasmFiles = [ | ||
| 'tree-sitter-typescript.wasm', | ||
| 'tree-sitter-tsx.wasm', | ||
| 'tree-sitter-javascript.wasm', | ||
| 'tree-sitter-python.wasm', | ||
| 'tree-sitter-java.wasm', | ||
| 'tree-sitter-kotlin.wasm', | ||
| 'tree-sitter-go.wasm', | ||
| 'tree-sitter-rust.wasm' | ||
| ]; | ||
|
|
||
| // Copy each WASM file | ||
| let copiedCount = 0; | ||
| for (const file of wasmFiles) { | ||
| const sourcePath = path.join(sourceDir, file); | ||
| const targetPath = path.join(targetDir, file); | ||
|
|
||
| try { | ||
| if (fs.existsSync(sourcePath)) { | ||
| fs.copyFileSync(sourcePath, targetPath); | ||
| console.log(`✓ Copied ${file}`); | ||
| copiedCount++; | ||
| } else { | ||
| console.warn(`⚠ Warning: ${file} not found in source directory`); | ||
| } | ||
| } catch (error) { | ||
| console.error(`✗ Failed to copy ${file}: ${error.message}`); | ||
| } | ||
| } | ||
|
|
||
| console.log(`\nCopied ${copiedCount}/${wasmFiles.length} WASM files to dist/wasm/`); | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The command
autodev.codelens.showMenuis registered incodelens-commands.tsand used incodelens-provider.ts(line 198), but it's not declared in thecommandssection of package.json. While VS Code allows undeclared commands for internal use, it's better practice to declare all commands for discoverability and consistency.Add the command declaration:
{ "command": "autodev.codelens.showMenu", "title": "AutoDev: Show CodeLens Menu" }