Quick actions in SourceCraft Code Assistant
For your convenience with the plugin, there are quick actions, i.e., Code Assistant integrations with your IDE.
The following integrations are available for Visual Studio Code:
- Lightbulb: Menu you access by clicking
- CodeLens: Buttons above the code blocks you can use to generate docs and tests and set up actions displayed in codelenses and lightbulbs.
- Context menu: Right-click menu you can use to generate docs and tests, send selected code to the chat, request code autocompletion/improvements, or generate a commit message in the Git version control system.
For JetBrains IDEs, there are codelenses that can generate docs and tests.
Functionality varies depending on the IDE you are using.
Note
The interface language of the Visual Studio Code plugin depends on the selected IDE language.
Generating tests
In the codelens or lightbulb next to the code section you want to generate tests for, click SourceCraft Code Assistant: Generate Tests.
Alternatively, you can right-click within the code section for which you want to generate tests and select SourceCraft Code Assistant → Generate Tests.
The generated tests will appear in a new chat.
Above the code section you want to generate tests for, click SourceCraft Code Assistant: Generate Tests.
The generated tests will appear in a new chat.
Generating docs
In the codelens or lightbulb next to the code section you want to generate docs for, click SourceCraft Code Assistant: Generate Docs.
Alternatively, you can right-click within the code section for which you want to generate docs and select SourceCraft Code Assistant → Generate Docs.
The docs will be suggested in the form of a code section comment. To accept or reject the comment, click Accept (Ctrl + Y in Windows/Linux or Command + Y in macOS) or Reject (Ctrl + N in Windows/Linux or Command + N in macOS).
Above the code section you want to generate docs for, click SourceCraft Code Assistant: Generate Docs.
The generated docs will appear in a new chat.
Refactoring code
This feature is only available in Visual Studio Code.
- Select the code section you need refactored.
- Right-click to open the context menu and select SourceCraft Code Assistant → Refactor code.
The refactored code and explanations will appear in a new chat.
Sending a code section to a chat
This feature is only available in Visual Studio Code.
-
Select the code section.
-
Right-click to open the context menu and select SourceCraft Code Assistant → Add Selection to Chat.
Alternatively, you can use Ctrl + I in Windows/Linux or Command + I in macOS.
Generating a commit message
This feature is only available in Visual Studio Code.
Only the Git version control system is supported.
In the editor, right-click to open the context menu and select SourceCraft Code Assistant → Commit Description.
You will see a change summary and commit message in a new chat.
Setting up actions displayed in code lenses and lightbulbs
This feature is only available in Visual Studio Code.
- In the codelens above the code section, click
- In the settings window that opens, select which actions should appear in codelenses and which in lightbulbs.
Invoking code autocompletion
This feature is only available in Visual Studio Code.
- Position the cursor to where you want to invoke autocompletion.
- Right-click to open the context menu and select SourceCraft Code Assistant → Suggest code.