我想在Mac上使用PyCharm中的GitHub Copilot。Tab键很好用,但我无法浏览以前和下一个代码建议。文档说我应该使用:
Option+]
Option+[
但是如果我这样做,我的代码中只会出现括号。我应该按Option + 5或Option + 6键,对吗?
我想在Mac上使用PyCharm中的GitHub Copilot。Tab键很好用,但我无法浏览以前和下一个代码建议。文档说我应该使用:
Option+]
Option+[
但是如果我这样做,我的代码中只会出现括号。我应该按Option + 5或Option + 6键,对吗?
我本以为我遇到了这个问题。
结果发现,在许多情况下,当前版本的Copilot只有一个建议。
您可以将鼠标悬停在建议上,以查看Copilot是否具有备选建议。对于我来说,在快捷键“无法使用”的情况下,根本没有其他可用的建议。
针对Visual Studio Code
Manage -> Keyboard Shortcuts
搜索这两个表达式; 上一页
editor.action.inlineSuggest.showPrevious
editor.action.inlineSuggest.showNext
决定您想要放置哪些快捷方式。
恭喜,现在它正在运行。
来触发第一个建议,然后使用下一个和上一个快捷键来循环浏览建议。Option+\
Alt+]
和Alt+[
。对于其他操作系统和IDE/编辑器的键盘快捷键,请参考链接:https://docs.github.com/en/copilot/configuring-github-copilot/configuring-github-copilot-in-your-environment?tool=vscode。我在我的Mac上配置了NvChad和neovim,两者都非常出色。如果您没有修改默认的Copilot键映射TAB
,那么您应该可以按照Copilot插件的建议进行操作。
我使用OPT
+ [
或OPT
+ ]
进行建议,或者使用TAB
进行当前建议。
: help Copilot
The argument to copilot#Accept() is the fallback for when no suggestion is
displayed. In this example, a regular carriage return is used. If no
fallback is desired, use an argument of "" (an empty string).
Other Maps
*copilot-i_CTRL-]*
<C-]> Dismiss the current suggestion.
<Plug>(copilot-dismiss)
*copilot-i_ALT-]*
<M-]> Cycle to the next suggestion, if one is available.
<Plug>(copilot-next)
*copilot-i_ALT-[*
<M-[> Cycle to the previous suggestion.
<Plug>(copilot-previous)
*copilot-i_ALT-\*
<M-\> Explicitly request a suggestion, even if Copilot
<Plug>(copilot-suggest) is disabled.