-
Notifications
You must be signed in to change notification settings - Fork 80
VS Code Usage
Hellebore edited this page Mar 24, 2020
·
10 revisions
Sourcery scans the currently open Python file. If it finds improvements in your code it returns them as a list of Info-level problems. You can see these directly in the code editor as underlined sections.
Hovering over a suggestion with the mouse will show you the suggested diff.
The refactorings appear in the Problems window (Ctrl+Shift+M). You can navigate between problems using F8.
Refactorings are applied via a Quick Fix:
- Press
Ctrl+.
on the suggested refactoring and it will bring up the quick fix menu with an option to apply it. - Hover the mouse over the refactoring and a lightbulb will appear. Click the lightbulb and apply the refactoring.
- Hovering over the refactoring in the Problems window will also show this lightbulb.
There are 2 options:
- Add this comment to the function definition:
# sourcery off
.
For example:def func(a, b): # sourcery off return a + b
- Bring up the quick fix menu for the refactoring and select the
Disable Sourcery for this function
option
Please visit our newer docs at https://docs.sourcery.ai