Rejecting suggestions when attempting to tab in pycharm #7558
-
One bit of annoying behaviour that I have encountered in pycharm is when starting a new line and copilot has a suggestion. If i don't want to accept the suggestion, I hit escape to ignore it which works great. But if i then need to tab a couple of times to get to the right place on the line (say from 3rd tab to 4th tab .. or col 13 -> 17), the suggestions get repeated. If i have to tab many times (like when starting from col 0), this gets irritating. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Would you expect that completion don't show up at all for the current line after pressing escape? The next update will improve TAB handling to match the VSCode plugin's behaviour. Then, pressing TAB will only insert a suggestions if it's right before the text cursor. As a workaround you could either change the shortcut from TAB to something else ( |
Beta Was this translation helpful? Give feedback.
-
Awesome. Will try those workarounds. Thanks! Yeah, i think if i have ignored a suggestion and not not made any other changes (which aren't whitespace) i would not expect a new suggestion until i do something "meaningful". |
Beta Was this translation helpful? Give feedback.
-
This still seems to be an issue for me, I'm using v1.2.8.2631 of copilot on pycharm 2023.1.2 Edit: after a while I found that pressing the 'end' key will take you to the next logical indent anyway, so that can be used to circumvent the tab completion where it's not wanted. Slightly less convenient, but better than the tab esc tab esc tab esc shenanigans I started with :) |
Beta Was this translation helpful? Give feedback.
-
The problem boils down to a single key (Tab) being assigned to two different functions. There's really no way to make that work well. My solution (also suggested above by @jansorg) was to change the shortcut associated with Copilot. I'm on a Mac, which has an "Option" key, so I used Option-\ (backslash), which I can easily select with thumb and forefinger of my right hand. This has worked out great for me. |
Beta Was this translation helpful? Give feedback.
Would you expect that completion don't show up at all for the current line after pressing escape?
The next update will improve TAB handling to match the VSCode plugin's behaviour. Then, pressing TAB will only insert a suggestions if it's right before the text cursor.
As a workaround you could either change the shortcut from TAB to something else (
Preferences > Keymap > Plugins > GitHub Copilot
) or turn off automatic completions (Preferences > Languages & Frameworks > GitHub Copilot
).