Skip to content

Commit

Permalink
docs: add Expert Code Enhancer doc
Browse files Browse the repository at this point in the history
  • Loading branch information
2214962083 committed Aug 15, 2024
1 parent 072d54b commit 3cdaba1
Show file tree
Hide file tree
Showing 17 changed files with 240 additions and 53 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ https://github.com/user-attachments/assets/55f85f8e-7515-4da3-b850-9c078b3440d5

- 🔄 **[Code Convert](https://aide.nicepkg.cn/guide/features/code-convert)**: Transform code between any programming languages with one click.
- 📖 **[Code Viewer Helper](https://aide.nicepkg.cn/guide/features/code-viewer-helper)**: Add detailed comments to enhance code readability.
- 🔀 **[Smart Paste](https://aide.nicepkg.cn/guide/features/smart-paste)**: Intelligently convert clipboard content (code or images) when pasting.
- 🤖 **[AI Batch Processor](https://aide.nicepkg.cn/guide/features/batch-processor)**: Process multiple files using AI according to custom requirements.
- 🔧 **[Expert Code Enhancer](https://aide.nicepkg.cn/guide/features/expert-code-enhancer)**: Hand your code over to AI for optimization and see how an expert would write it.
- 📋 **[Smart Paste](https://aide.nicepkg.cn/guide/features/smart-paste)**: Intelligently convert clipboard content (code or images) when pasting.
- 🗂️ **[AI Batch Processor](https://aide.nicepkg.cn/guide/features/batch-processor)**: Process multiple files using AI according to custom requirements.
- 🏷 **[Rename Variable](https://aide.nicepkg.cn/guide/features/rename-variable)**: Get AI-suggested variable names with explanations.
- 💬 **[Ask AI](https://aide.nicepkg.cn/guide/features/ask-ai)**: Execute custom AI commands on selected files or folders.
- 📋 **[Copy as AI Prompt](https://aide.nicepkg.cn/guide/features/copy-as-prompt)**: Easily copy files/folders content as AI prompts.
- 📝 **[Copy as AI Prompt](https://aide.nicepkg.cn/guide/features/copy-as-prompt)**: Easily copy files/folders content as AI prompts.

## Installation 📦

Expand Down
7 changes: 4 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ https://github.com/user-attachments/assets/55f85f8e-7515-4da3-b850-9c078b3440d5

- 🔄 **[代码转换](https://aide.nicepkg.cn/zh/guide/features/code-convert)**: 一键在任何编程语言之间转换代码。
- 📖 **[代码查看器助手](https://aide.nicepkg.cn/zh/guide/features/code-viewer-helper)**: 添加详细注释以提高代码可读性。
- 🔀 **[智能粘贴](https://aide.nicepkg.cn/zh/guide/features/smart-paste)**: 粘贴时智能转换剪贴板内容(代码或图片)。
- 🤖 **[AI 批量处理文件](https://aide.nicepkg.cn/zh/guide/features/batch-processor)**: 根据自定义要求使用 AI 处理多个文件。
- 🔧 **[让大师帮你改代码](https://aide.nicepkg.cn/zh/guide/features/expert-code-enhancer)**: 把你的代码给 AI 优化,看看大师是怎么写代码的。
- 📋 **[智能粘贴](https://aide.nicepkg.cn/zh/guide/features/smart-paste)**: 粘贴时智能转换剪贴板内容(代码或图片)。
- 🗂️ **[AI 批量处理文件](https://aide.nicepkg.cn/zh/guide/features/batch-processor)**: 根据自定义要求使用 AI 处理多个文件。
- 🏷 **[重命名变量](https://aide.nicepkg.cn/zh/guide/features/rename-variable)**: 获取 AI 建议的变量名及解释。
- 💬 **[问 AI](https://aide.nicepkg.cn/zh/guide/features/ask-ai)**: 对选定的文件或文件夹执行自定义 AI 命令。
- 📋 **[复制为 AI 提示词](https://aide.nicepkg.cn/zh/guide/features/copy-as-prompt)**: 轻松复制文件/文件夹内容作为 AI 提示。
- 📝 **[复制为 AI 提示词](https://aide.nicepkg.cn/zh/guide/features/copy-as-prompt)**: 轻松复制文件/文件夹内容作为 AI 提示。

## 安装 📦

Expand Down
7 changes: 4 additions & 3 deletions README_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ https://github.com/user-attachments/assets/55f85f8e-7515-4da3-b850-9c078b3440d5

- 🔄 **[コード変換](https://aide.nicepkg.cn/guide/features/code-convert)**: ワンクリックで任意のプログラミング言語間でコードを変換します。
- 📖 **[コードビューアヘルパー](https://aide.nicepkg.cn/guide/features/code-viewer-helper)**: 詳細なコメントを追加してコードの可読性を向上させます。
- 🔀 **[スマートペースト](https://aide.nicepkg.cn/guide/features/smart-paste)**: クリップボードの内容(コードや画像)を貼り付け時にインテリジェントに変換します。
- 🤖 **[AI バッチプロセッサ](https://aide.nicepkg.cn/guide/features/batch-processor)**: カスタム要件に従って AI を使用して複数のファイルを処理します。
- 🔧 **[エキスパートコードエンハンサー](https://aide.nicepkg.cn/guide/features/expert-code-enhancer)**: コードを AI に渡して最適化し、エキスパートがどのように書くか見てみましょう。
- 📋 **[スマートペースト](https://aide.nicepkg.cn/guide/features/smart-paste)**: クリップボードの内容(コードや画像)を貼り付け時にインテリジェントに変換します。
- 🗂️ **[AI バッチプロセッサ](https://aide.nicepkg.cn/guide/features/batch-processor)**: カスタム要件に従って AI を使用して複数のファイルを処理します。
- 🏷 **[変数のリネーム](https://aide.nicepkg.cn/guide/features/rename-variable)**: 説明付きの AI 提案の変数名を取得します。
- 💬 **[AI に質問](https://aide.nicepkg.cn/guide/features/ask-ai)**: 選択したファイルやフォルダにカスタム AI コマンドを実行します。
- 📋 **[AI プロンプトとしてコピー](https://aide.nicepkg.cn/guide/features/copy-as-prompt)**: ファイル/フォルダの内容を AI プロンプトとして簡単にコピーします。
- 📝 **[AI プロンプトとしてコピー](https://aide.nicepkg.cn/guide/features/copy-as-prompt)**: ファイル/フォルダの内容を AI プロンプトとして簡単にコピーします。

## インストール 📦

Expand Down
30 changes: 6 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,6 @@
"onStartupFinished"
],
"contributes": {
"viewsContainers": {
"activitybar": [
{
"id": "aide",
"title": "Aide",
"icon": "res/icon-mask.png"
}
]
},
"views": {
"aide": [
{
"type": "webview",
"id": "aide.webview",
"name": "Aide"
}
]
},
"commands": [
{
"command": "aide.copyAsPrompt",
Expand Down Expand Up @@ -231,12 +213,6 @@
"scope": "resource",
"markdownDescription": "%config.codeViewerHelperPrompt.description%"
},
"aide.expertCodeEnhancerPromptList": {
"type": "array",
"default": [],
"scope": "resource",
"markdownDescription": "%config.expertCodeEnhancerPromptList.description%"
},
"aide.convertLanguagePairs": {
"type": "object",
"default": {},
Expand All @@ -248,6 +224,12 @@
"default": true,
"markdownDescription": "%config.autoRememberConvertLanguagePairs.description%"
},
"aide.expertCodeEnhancerPromptList": {
"type": "array",
"default": [],
"scope": "resource",
"markdownDescription": "%config.expertCodeEnhancerPromptList.description%"
},
"aide.readClipboardImage": {
"type": "boolean",
"default": false,
Expand Down
8 changes: 4 additions & 4 deletions src/extension/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ const configKey = {
...pkgConfig['aide.aiCommandAutoRun'],
type: 'boolean'
},
expertCodeEnhancerPromptList: {
...pkgConfig['aide.expertCodeEnhancerPromptList'],
type: 'array'
},
autoRememberConvertLanguagePairs: {
...pkgConfig['aide.autoRememberConvertLanguagePairs'],
type: 'boolean'
Expand All @@ -76,10 +80,6 @@ const configKey = {
type: 'object',
optional: true
},
expertCodeEnhancerPromptList: {
...pkgConfig['aide.expertCodeEnhancerPromptList'],
type: 'array'
},
codeViewerHelperPrompt: {
...pkgConfig['aide.codeViewerHelperPrompt'],
type: 'string'
Expand Down
3 changes: 1 addition & 2 deletions src/extension/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { logger } from './logger'
import { enablePolyfill } from './polyfill'
import { registerProviders } from './providers'
import { initAideKeyUsageStatusBar } from './providers/aide-key-usage-statusbar'
import { renderWebview } from './providers/webview'
import { redisStorage, stateStorage } from './storage'

export const activate = async (context: vscode.ExtensionContext) => {
Expand All @@ -31,7 +30,7 @@ export const activate = async (context: vscode.ExtensionContext) => {
await initAideKeyUsageStatusBar(context)
await autoOpenCorrespondingFiles(context)
await cleanup(context)
await renderWebview(context)
// await renderWebview(context)
} catch (err) {
logger.warn('Failed to activate extension', err)
}
Expand Down
20 changes: 20 additions & 0 deletions src/extension/providers/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@ import { saveImage, setupHtml } from '@extension/utils'
import type { WebviewToExtensionsMsg } from '@shared/types/msg'
import * as vscode from 'vscode'

// {
// "viewsContainers": {
// "activitybar": [
// {
// "id": "aide",
// "title": "Aide",
// "icon": "res/icon-mask.png"
// }
// ]
// },
// "views": {
// "aide": [
// {
// "type": "webview",
// "id": "aide.webview",
// "name": "Aide"
// }
// ]
// },
// }
class AideWebViewProvider implements vscode.WebviewViewProvider {
public static readonly viewType = 'aide.webview'

Expand Down
8 changes: 8 additions & 0 deletions website/.vitepress/config/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ function sidebar(): DefaultTheme.Sidebar {
text: 'Code Convert',
link: '/code-convert'
},
{
text: 'Expert Code Enhancer',
link: '/expert-code-enhancer'
},
{
text: 'Smart Paste',
link: '/smart-paste'
Expand Down Expand Up @@ -141,6 +145,10 @@ function sidebar(): DefaultTheme.Sidebar {
text: 'aide.autoRememberConvertLanguagePairs',
link: '/auto-remember-convert-language-pairs'
},
{
text: 'aide.expertCodeEnhancerPromptList',
link: '/expert-code-enhancer-prompt-list'
},
{
text: 'aide.readClipboardImage',
link: '/read-clipboard-image'
Expand Down
8 changes: 8 additions & 0 deletions website/.vitepress/config/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ function sidebar(): DefaultTheme.Sidebar {
text: '智能代码转换',
link: '/code-convert'
},
{
text: '让大师帮你改代码',
link: '/expert-code-enhancer'
},
{
text: '智能粘贴',
link: '/smart-paste'
Expand Down Expand Up @@ -172,6 +176,10 @@ function sidebar(): DefaultTheme.Sidebar {
text: 'aide.autoRememberConvertLanguagePairs',
link: '/auto-remember-convert-language-pairs'
},
{
text: 'aide.expertCodeEnhancerPromptList',
link: '/expert-code-enhancer-prompt-list'
},
{
text: 'aide.readClipboardImage',
link: '/read-clipboard-image'
Expand Down
42 changes: 42 additions & 0 deletions website/en/guide/configuration/expert-code-enhancer-prompt-list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# aide.expertCodeEnhancerPromptList

This configuration allows you to customize ==the AI prompt list for expert code enhancement==.

With these prompts, you can specify how to optimize and refactor your code. Prompts can be customized to match specific files based on file path patterns.

**Prompt Configuration Fields:**

| Field | Description | Required | Default |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- |
| `match` | File path matching pattern, supports [glob](https://github.com/isaacs/node-glob) syntax. The prompt will only be displayed if the current file path matches. | No | `"**/*"` |
| `title` | Title of the prompt, displayed in the selection list. | Yes | |
| `prompt` | Content of the prompt, describing the optimization operation needed. | Yes | |
| `sort` | Sorting weight, the smaller the number, the higher it ranks. | No | `1000` |
| `autoContext` | Whether to enable automatic context support. When enabled, AI will also read files potentially related to the current file before processing the code. Defaults to `false`. Requires the `function_call` feature. | No | `false` |

**Usage Example:**

```json
{
"aide.expertCodeEnhancerPromptList": [
{
"match": ["**/*.sql", "**/*Repository.{java,kt,scala,cs,py,js,ts}"],
"title": "Optimize Database Queries",
"prompt": "Analyze and optimize the database queries in the following code. Focus on improving query performance, reducing unnecessary joins, optimizing indexing suggestions, and ensuring efficient data retrieval patterns.",
"autoContext": true
},
{
"match": ["**/*.vue", "**/*.tsx", "**/*.jsx"],
"title": "Split Into Smaller Components",
"prompt": "Analyze the following code and split it into smaller, more manageable components. Focus on identifying reusable parts, separating concerns, and improving overall component structure. Provide the refactored code.",
"autoContext": true
},
{
"match": "**/*",
"title": "Optimize Using DRY Principles",
"prompt": "Refactor the following code to eliminate redundancy and improve maintainability by applying the DRY (Don't Repeat Yourself) principle. Identify repeated code patterns and abstract them into reusable functions or classes as appropriate.",
"autoContext": false
}
]
}
```
37 changes: 37 additions & 0 deletions website/en/guide/features/expert-code-enhancer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Expert Code Enhancer

Command Name: `aide.expertCodeEnhancer`

Use AI to optimize and refactor the entire file or selected code. Supports multiple programming languages.

::: warning Warning

This feature sometimes requires AI models that support the `function_call` capability.

:::

**Scenarios:**

- When inheriting a legacy project, you want to optimize hard-to-read code.
- Helps you clean up and refactor legacy code to make it more readable.
- You want to improve your own coding skills.
- Helps you refactor code following principles like SOLID and DRY.
- Automatically applies appropriate design patterns to your code.
- Automatically checks and fixes security vulnerabilities in your code.
- Automatically detects and optimizes performance issues in your code.
- Allows custom AI optimization prompts for specific files, replacing many traditional code handling scripts.

**Usage:**

- Select the code in the editor.
- Click the pencil icon at the top right or right-click and select `✨ Aide: Expert Code Enhancer`.

::: tip
If the output is interrupted, you can click the original pencil icon or right-click and select `✨ Aide: Expert Code Enhancer` to continue.
:::

<Video src="/videos/aide-expert-code-enhancer.mp4"/>

**Related Configuration:**

- You can customize the corresponding AI prompt templates by configuring [`aide.expertCodeEnhancerPromptList`](../configuration/expert-code-enhancer-prompt-list.md).
18 changes: 11 additions & 7 deletions website/en/guide/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

==Aide== is a powerful AI-assisted development ==VSCode== extensions designed to enhance your coding experience. Here's why you should choose ==Aide==:

- **📚 Improved Code Readability**: Add detailed comments to your code with one click, improving readability without modifying the original file.
- **📖 Improved Code Readability**: Add detailed comments to your code with one click, improving readability without modifying the original file.

- **🔄 Effortless Code Conversion**: Convert code between languages or frameworks instantly, making it easier to understand unfamiliar code or migrate projects.

- **🔧 Let the Expert Enhance Your Code**: Hand your code over to AI for optimization and see how an expert would write it.

- **🔮 Magical Smart Paste**: Intelligently convert clipboard content when pasting, including transforming design screenshots into UI code. Streamlines cross-language, cross-framework development, and design-to-code workflows.

- **📋 Efficient Batch Processing**: Easily process multiple files or folders with AI, significantly boosting your productivity.
- **🗂️ Efficient Batch Processing**: Easily process multiple files or folders with AI, significantly boosting your productivity.

- **🏷️ Intelligent Variable Renaming**: Get AI-powered variable name suggestions with explanations, helping you choose the best names for your code.

Expand All @@ -25,15 +27,17 @@

2. **[Code Convert](../features/code-convert.md)**: Transform code from one programming language to another with AI assistance.

3. **[Smart Paste](../features/smart-paste.md)**: Intelligently convert clipboard content when pasting into different file types.
3. **[Expert Code Enhancer](../features/expert-code-enhancer.md)**: Use AI to optimize and refactor entire files or selected code, moving a step closer to senior engineering.

4. **[Smart Paste](../features/smart-paste.md)**: Intelligently convert clipboard content when pasting into different file types.

4. **[AI Batch Processor](../features/batch-processor.md)**: Process multiple files with AI according to your specific requirements
5. **[AI Batch Processor](../features/batch-processor.md)**: Process multiple files with AI according to your specific requirements

5. **[Copy Multiple Files As AI Prompt](../features/copy-as-prompt.md)**: Format multiple files as AI interaction prompts with a single click.
6. **[Copy Multiple Files As AI Prompt](../features/copy-as-prompt.md)**: Format multiple files as AI interaction prompts with a single click.

6. **[Rename Variable](../features/rename-variable.md)**: Get AI suggestions for variable names to improve code clarity.
7. **[Rename Variable](../features/rename-variable.md)**: Get AI suggestions for variable names to improve code clarity.

7. **[Ask AI With Custom Command](../features/ask-ai.md)**: Execute customized AI commands on selected files or folders.
8. **[Ask AI With Custom Command](../features/ask-ai.md)**: Execute customized AI commands on selected files or folders.

## Differences Between ==Aide== and ==Copilot/Cursor/Codeium/AmazonQ==

Expand Down
Binary file not shown.
Loading

0 comments on commit 3cdaba1

Please sign in to comment.