gpt4 book ai didi

visual-studio-code - 如何在 VSCode 中触发 "inline suggestion"?

转载 作者:行者123 更新时间:2023-12-05 01:58:48 28 4
gpt4 key购买 nike

有两个用于显示“内联建议”的内置命令:

  • editor.action.inlineSuggest.showPrevious
  • editor.action.inlineSuggest.showNext

我都试过了,但是没有任何反应,在什么情况下可以触发内联建议?

最佳答案

对于 v1.58,请参阅 Inline Suggestions :

Inline Suggestions

The inline suggestions API allows extensions to provide inline suggestions that are decoupled from the suggestion widget. An inline suggestion is rendered as if it was already accepted, but with a gray color. Users can cycle through suggestions and accept them with the Tab key.

vscode.languages.registerInlineCompletionItemProvider(
{ pattern: '**' },
{
provideInlineCompletionItems: async (document, position) => {
return [{ text: '< 2) {\n\treturn 1;\n\t}' }]
},
},
)

演示:

enter image description here

关于visual-studio-code - 如何在 VSCode 中触发 "inline suggestion"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68263285/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com