Skip to content

Coding Assistant Configuration

Enabling/Disabling the Coding Assistant

In order to use Sourcery Chat or the Sourcery Coding Assistant you need to send relevant pieces of your code and your messages to third party model providers.

If you want to opt out completely, you can do so through your user-level sourcery.yaml file.

To disable the Coding Assistant update this section of the file to:

coding_assistant:
    enabled: False

Customising Recipes

You can customise the prompts for recipes by adding a recipe_prompts section to your sourcery.yaml file. The custom prompts will be appended to the recipe prompt when the recipe is called.

The available recipe names are:

  • generate_tests
  • generate_diagram
  • explain_code
  • generate_docstrings
coding_assistant:
    recipe_prompts:
        <recipe_name>: <custom_prompt>

Suggest AI Fixes

By default, in VS Code, Sourcery will suggest AI fixes for all problems in the Problems pane. You can switch this feature on or off by setting the suggestFixes setting to true or false in the VS Code settings. This can also be accessed from the settings menu in the Sourcery sidebar.

Code Lens Configuration

Code Lenses are the Sourcery command shortcuts that appear above a section of code (eg. Generate Tests) and trigger a response from the Coding Assistant. To disable the Code Lenses go to the Sourcery extension/plugin settings in your IDE and uncheck the Sourcery: Code Lens option.