Skip to main content

Slash Commands

Optimize Code

💡Usage

Taking VSCode as an example, CodeSouler currently supports the following methods for code fixing, optimization, and refactoring:

1. Right-click on selected code block

Select the code block you want to comment on, right-click, and choose "Fix this Code" or "Optimize this Code" from the CodeSouler options. When there are problematic code sections marked with red underlines that need to be addressed, you can select "Fix this Code" to have CodeSouler provide solutions. When some code needs to be optimized, you can use "Optimize this Code" to refactor it for better robustness and readability.

2. Write prompts in the chat box

After selecting a specific code block, write a prompt like "Please refactor this code to ensure code robustness", and CodeSouler can also achieve code optimization and refactoring effects.

Writing Docstrings

💡Usage

Taking VSCode as an example, this feature is currently implemented mainly through the /docstring operator in the chat box, generating corresponding documentation strings for code blocks (including function functionality, parameters, descriptions, and possible exceptions that may be thrown). By using @file to specify a file for /docstring in the CodeSouler chat box, CodeSouler will generate corresponding documentation strings for each component of the entire code document.

img

Write Comments

💡Usage

Taking VSCode as an example, CodeSouler currently supports several methods to add comments to code:

1. Right-click on selected code block

Select the code block you want to comment on, right-click, and choose "Write Comments for this Code" from the CodeSouler options. CodeSouler will embed comments into the code in real-time. After the operation is complete, you can choose to accept/reject each comment revision, or accept/reject all changes.

img

2. Use the /comment operator

Taking VSCode as an example, select the code block you want to comment on, use the shortcut Ctrl + L (in JetBrains it's Ctrl + J), and CodeSouler will pop up a chat window and reference the selected code block in the chat box. Then input the /comment command to get code comments.

img

3. Write prompts in the chat box

After selecting a specific code block, directly write a prompt like "Please write Chinese comments for me", and CodeSouler can also implement the function of adding comments.

img

Code Review

💡Usage

Taking VSCode as an example, code review is currently mainly implemented through the /codereview operator in the chat box, enabling code review for multiple object types.

1. Code segments

Select a code segment, use the shortcut Command + L / Ctrl + L to add it to the dialog context, input /codereview, and CodeSouler will analyze the code segment content and generate corresponding review reports and modification suggestions.

The generated modification suggestions can be directly applied or inserted into the original code by clicking the options in the upper right corner.

2. Specified files

Use @file in the CodeSouler chat box to specify a file for /codereview, and CodeSouler will review the entire file and provide modification suggestions. Users can accept or reject revisions for each modification.

3. Code Review for Git diff

In addition to providing code reviews for code segments and project files, CodeSouler also supports providing code review opinions for entire project modifications (Git diff), specifically evaluating modification content. This operation can be quickly implemented by combining @Git diff and /codereview.

Security Scanning

💡Usage

Taking VSCode as an example, security scanning is currently mainly implemented through the /secscan operator in the chat box, enabling security scanning for multiple object types.

1. Code segments

Select a code segment, use the shortcut Command + L / Ctrl + L to add it to the dialog context, input /secscan, and CodeSouler will analyze the code segment content and generate corresponding security scan reports and modification suggestions.

The generated modification suggestions can be directly applied or inserted into the original code by clicking the options in the upper right corner.

2. Specified files

Use @file in the CodeSouler chat box to specify a file for /secscan, and CodeSouler will scan the entire file and provide modification suggestions. Users can accept or reject revisions for each modification.

Generate Test Cases

💡Usage

Taking VSCode as an example, this feature is currently implemented mainly through the /test operator in the chat box, generating corresponding test cases for selected code blocks.

By selecting a function code block with specific functionality, CodeSouler will generate corresponding test cases for the selected code block.

Alt text