-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] AI 模块的代码补全 API 调整 #3853
Labels
🎨 feature
feature required
Comments
API 设计registerIntelligentCompletionFeature(registry: IIntelligentCompletionRegistry): void; /**
* editor: 当前编辑器
* position: 当前光标位置
* requestBean: 补全请求参数
* @returns: IIntelligentCompletionsResult
*/
interface IIntelligentCompletionRegistry {
provideIntelligentCompletions(editor: ICodeEditor, position: IPosition, requestBean: IAICompletionOption, token: CancellationToken): MaybePromise<IIntelligentCompletionsResult>;
} export interface IIntelligentCompletionsResult {
readonly items: IInlineCompletionItem[]
}
export interface IInlineCompletionItem {
/**
* 补全的内容
*/
content: string;
/**
* 表示当前行之前需要再补全几行
* 最大值为 3
*/
aboveRadius?: number;
/**
* 表示当前行之后需要再补全几行
* 最大值为 3
*/
belowRadius?: number;
} 暂定这些接口。 集成方只需要返回 这里有两个新字段是 默认情况下,只传 content 字段时,则与现在的代码补全交互一致,会在光标之后补全代码内容 |
5 tasks
API 设计调整
所以将这两个字段删除,改成用 return {
items: [
{
insertText: 'xxx',
range // 要补全的范围可以通过 range 去控制,替换了上述的 aboveRadius 和 belowRadius
},
],
enableMultiLine: true // 表明这个补全内容是多行补全,如果为 false 则与传统补全一致
}; 注: 开启了 enableMultiLine 之后必须传递 range 字段 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如果你的需求与问题相关,请在下面描述一下(Is your feature request related to a problem? Please describe.)
现在AI 模块下的所有功能都是设计在 contribution 下的。
唯独代码补全的 api 是写在 back service 里的,也不好拓展,这是当初的设计缺陷,现在应该需要调整到 contribution 下
描述你预期的功能表现(Describe the solution you'd like)
可能会提供以下 API
The text was updated successfully, but these errors were encountered: