-
Notifications
You must be signed in to change notification settings - Fork 384
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
feat: support multi inline completion #3874
Conversation
This PR was not deployed automatically as @Ricbet does not have access to the Railway project. In order to get automatic PR deploys, please add @Ricbet to the project inside the project settings page. |
Walkthrough此次更改显著增强了 AI Native 功能,特别是在编辑器中引入了智能补全特性。通过新注册的智能补全处理程序和相应的装饰模型,用户可以在编程时获得更智能、上下文相关的代码建议。同时,重构的控制流简化了贡献注册过程,提高了代码的可维护性和可读性,整体提升了用户体验。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Editor
participant IntelligentCompletionsHandler
participant MultiLineDiffComputer
participant MultiLineDecorationModel
User->>Editor: 输入代码
Editor->>IntelligentCompletionsHandler: 更新游标位置
IntelligentCompletionsHandler->>MultiLineDiffComputer: 计算差异
MultiLineDiffComputer->>IntelligentCompletionsHandler: 返回差异结果
IntelligentCompletionsHandler->>MultiLineDecorationModel: 更新内联装饰
MultiLineDecorationModel->>Editor: 在编辑器中显示补全建议
Possibly related issues
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (5)
Files skipped from review as they are similar to previous changes (2)
Additional context usedBiome
Additional comments not posted (19)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range, codebase verification and nitpick comments (1)
packages/ai-native/src/browser/contrib/intelligent-completions/diff-computer.ts (1)
54-184
: 方法diff
已正确实现,但建议添加注释以提高理解。该方法计算两个字符串之间的差异,逻辑复杂但正确。建议添加注释以提高代码的可读性和理解。
+ // Clone an element const cloneElement = (element: IElement): IElement => ({ newPos: element.newPos, changeResult: [...element.changeResult], }); + // Join content array into a single string const join = (content: string[]) => content.join(empty); + // Process elements to compute the final diff result const processElements = (changeResult: IResultWithCount[], modified: string[], original: string[]) => { const modifiedLength = changeResult.length;
packages/ai-native/src/browser/contrib/intelligent-completions/diff-computer.ts
Show resolved
Hide resolved
packages/ai-native/src/browser/contrib/intelligent-completions/completions-inline.decoration.ts
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3874 +/- ##
==========================================
+ Coverage 54.80% 54.88% +0.07%
==========================================
Files 1561 1566 +5
Lines 95260 95564 +304
Branches 19533 19599 +66
==========================================
+ Hits 52210 52453 +243
- Misses 35737 35793 +56
- Partials 7313 7318 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (3)
packages/ai-native/src/browser/contrib/intelligent-completions/intelligent-completions.handler.ts (1)
87-121
: 建议添加注释以提高可读性。虽然
registerFeature
函数实现良好,但添加注释可以提高代码的可读性。public registerFeature(editor: IEditor): IDisposable { this.editor = editor; const { monacoEditor } = editor; this.multiLineDecorationModel = new MultiLineDecorationModel(monacoEditor); const stop = () => { this.cancelToken(); this.multiLineDecorationModel.clearDecorations(); }; /** * 触发时机与 inline completion 保持一致 */ this.addDispose([ monacoEditor.onDidType(() => { this.update(); }), Event.any<any>( monacoEditor.onDidChangeModel, monacoEditor.onDidBlurEditorWidget, )(() => { stop(); }), monacoEditor.onDidChangeCursorSelection((event: ICursorSelectionChangedEvent) => { if (event.reason === CursorChangeReason.Explicit || event.source === TextEditorSelectionSource.PROGRAMMATIC) { stop(); } }), ]); return this; }packages/ai-native/src/browser/contrib/intelligent-completions/multi-line.decoration.ts (1)
95-316
: 建议添加注释以提高可读性。虽然这些函数实现良好,但添加注释可以提高代码的可读性。
private processLineModifications( waitAddModificationsLines: IModificationsInline[], eol: string, previous: IDiffChangeResult, next?: IDiffChangeResult, ) { const lines = this.combineContinuousMods(waitAddModificationsLines); const len = lines.length; const fullLineMods: string[] = []; const inlineMods: IProcessModificationsInline[] = []; if (len === 0) { return { fullLineMods, inlineMods, }; } const firstLine = lines[0]; const lastLine = lines[len - 1]; if (len === 1) { if (!isUndefined(previous) && previous.value !== eol) { inlineMods.push({ status: EProcessStatus.beginning, newValue: previous.value + firstLine, oldValue: previous.value, }); } else if (!isUndefined(next) && next.value !== eol) { inlineMods.push({ status: EProcessStatus.end, newValue: lastLine + next.value, oldValue: next.value, }); } else { fullLineMods.push(firstLine); } return { fullLineMods, inlineMods, }; } if (isUndefined(previous) || previous.value === eol) { fullLineMods.push(firstLine); } else { inlineMods.push({ status: EProcessStatus.beginning, newValue: previous.value + firstLine, oldValue: previous.value, }); } if (len > 2) { const middleLines = lines.slice(1, -1); for (const line of middleLines) { fullLineMods.push(line); } } if (isUndefined(next) || next.value === eol) { fullLineMods.push(lastLine); } else { inlineMods.push({ status: EProcessStatus.end, newValue: lastLine + next.value, oldValue: next.value, }); } return { fullLineMods, inlineMods, }; } public clearDecorations(): void { this.ghostTextDecorations.clear(); } public updateLineModificationDecorations(modifications: IModificationsInline[]) { if (modifications.length === 0) { this.clearDecorations(); return; } const decorations: IModelDeltaDecoration[] = modifications.map((modification) => { let content: string; if (modification.newValue.startsWith(modification.oldValue)) { content = modification.newValue.slice(modification.oldValue.length); } else { const oldValueIndex = modification.newValue.indexOf(modification.oldValue); content = oldValueIndex !== -1 ? modification.newValue.slice(0, oldValueIndex) : modification.newValue; } return { range: Range.fromPositions(new Position(modification.lineNumber!, modification.column!)), options: { description: GHOST_TEXT, showIfCollapsed: true, after: { content, inlineClassName: GHOST_TEXT_DESCRIPTION, }, }, }; }); this.ghostTextDecorations.set(decorations); } public applyInlineDecorations( editor: ICodeEditor, changes: IDiffChangeResult[], startLine: number, cursorPosition: IPosition, ): IModificationsInline[] | undefined { startLine = Math.max(startLine - 1, 0); const model = editor.getModel(); if (!model) { return; } const eol = model.getEOL(); changes = this.splitDiffChanges(changes, eol); changes.unshift({ value: eol, added: undefined, removed: undefined, }); const currentLineText = model.getLineContent(cursorPosition.lineNumber); const resultModifications: IModificationsInline[] = []; let lastChange: IDiffChangeResult; let waitAddModificationsLines: IModificationsInline[] = []; let columnNumber = 1; const processChange = (change: IDiffChangeResult | undefined) => { const { fullLineMods, inlineMods } = this.processLineModifications( waitAddModificationsLines, eol, lastChange, change, ); inlineMods.forEach((mod) => resultModifications.push({ lineNumber: mod.status === EProcessStatus.beginning ? startLine : startLine + 1, column: mod.status === EProcessStatus.beginning ? columnNumber : 1, newValue: mod.newValue, oldValue: mod.oldValue, }), ); return { fullLineMods, inlineMods, }; }; let currentLineIndex = startLine; let previousValue = empty; let isEmptyLine = currentLineText.trim() === empty; for (const change of changes) { if (change.added) { const isEolLine = change.value === eol; if (isEolLine) { previousValue = empty; } waitAddModificationsLines.push({ isEolLine, lineNumber: startLine, newValue: isEolLine ? empty : change.value, oldValue: isEolLine ? empty : previousValue, }); } else { const { inlineMods } = processChange(change); if (startLine === cursorPosition.lineNumber && inlineMods.length > 0) { isEmptyLine = false; /** * 如果光标位置在首个 diff 结果的后面,则不显示多行补全 */ if (startLine < cursorPosition.lineNumber && columnNumber < cursorPosition.column) { return; } } lastChange = change; waitAddModificationsLines = []; // 如果 change 的值是 eol,则开启新的一行进行计算 if (change.value === eol) { currentLineIndex++; columnNumber = 1; previousValue = empty; } else { startLine = Math.max(startLine, currentLineIndex); columnNumber += change.value.length; previousValue += change.value; } } } const { fullLineMods } = processChange(undefined); if (!isEmptyLine && startLine < cursorPosition.lineNumber && fullLineMods.length > 0) { return; } return resultModifications; }packages/startup/entry/sample-modules/ai-native/ai-native.contribution.ts (1)
409-453
: 建议添加注释以提高可读性。虽然
registerIntelligentCompletionFeature
方法实现良好,但添加注释可以提高代码的可读性。registerIntelligentCompletionFeature(registry: IIntelligentCompletionsRegistry): void { registry.registerIntelligentCompletionProvider(async (editor, position, token) => { const model = editor.getModel()!; let value = model.getValueInRange({ startLineNumber: position.lineNumber, startColumn: 1, endLineNumber: position.lineNumber + 3, endColumn: model?.getLineMaxColumn(position.lineNumber + 3), }); /** * mock randown */ const getRandomString = (length) => { const characters = 'opensumi'; let result = ''; for (let i = 0; i < length; i++) { result += characters.charAt(Math.floor(Math.random() * characters.length)); } return result; }; const insertRandomStrings = (originalString) => { const numberOfInserts = Math.floor(Math.random() * 3) + 1; let modifiedString = originalString; for (let i = 0; i < numberOfInserts; i++) { const randomString = getRandomString(Math.floor(Math.random() * 2) + 1); const position = Math.floor(Math.random() * (modifiedString.length + 1)); modifiedString = modifiedString.slice(0, position) + randomString + modifiedString.slice(position); } return modifiedString; }; return { items: [ { // content: 'export class Personsss {\n name: string;\n ages: n__open__umber;\n}', content: insertRandomStrings(value), belowRadius </blockquote></details> </blockquote></details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
...ges/ai-native/src/browser/contrib/intelligent-completions/intelligent-completions.handler.ts
Outdated
Show resolved
Hide resolved
1879580
to
dd9f1b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Outside diff range, codebase verification and nitpick comments (3)
packages/ai-native/src/browser/contrib/intelligent-completions/intelligent-completions.contribution.ts (1)
1-13
: 确保所有导入的模块和常量都被正确使用。请确认所有导入的模块和常量在文件中都有使用,避免不必要的依赖。
packages/ai-native/src/browser/contrib/intelligent-completions/intelligent-completions.handler.ts (1)
1-18
: 确保所有导入的模块和常量都被正确使用。请确认所有导入的模块和常量在文件中都有使用,避免不必要的依赖。
packages/ai-native/src/browser/contrib/inline-completions/inline-completions.handler.ts (1)
Line range hint
1-13
:
确保所有导入的模块和常量都被正确使用。请确认所有导入的模块和常量在文件中都有使用,避免不必要的依赖。
...i-native/src/browser/contrib/intelligent-completions/intelligent-completions.contribution.ts
Outdated
Show resolved
Hide resolved
dd9f1b4
to
8bd600c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
...i-native/src/browser/contrib/intelligent-completions/intelligent-completions.contribution.ts
Outdated
Show resolved
Hide resolved
...ges/ai-native/src/browser/contrib/intelligent-completions/intelligent-completions.handler.ts
Outdated
Show resolved
Hide resolved
d59ffcc
to
a052b60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
packages/core-node/src/ai-native/base-back.service.ts (1)
需要更新或移除引用
requestCompletion
和reportCompletion
的代码在
BaseAIBackService
类中移除requestCompletion
和reportCompletion
方法后,以下文件中仍然存在对这些方法的引用或声明,需要进行相应的更新或移除:
packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
requestCompletion
方法引用reportCompletion
方法引用
packages/core-common/src/types/ai-native/index.ts
requestCompletion
方法声明reportCompletion
方法声明请确保所有依赖这些方法的代码已经被更新或移除,以避免运行时错误。
Analysis chain
Line range hint
1-1
:
移除方法requestCompletion
和reportCompletion
BaseAIBackService
类中移除了requestCompletion
和reportCompletion
方法,这意味着该服务不再处理 AI 补全请求和报告。这可能会影响依赖这些方法的组件或服务。请确保所有依赖这些方法的代码已经被更新或移除。
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if `requestCompletion` and `reportCompletion` methods are called in the codebase. # Test: Search for the method usage. Expect: No occurrences of the removed methods. rg --type ts -A 5 'requestCompletion|reportCompletion'Length of output: 4013
Script:
#!/bin/bash # Search for the implementation of `requestCompletion` and `reportCompletion` in the mentioned files rg 'requestCompletion' packages/startup/entry/sample-modules/ai-native/ai.back.service.ts rg 'reportCompletion' packages/startup/entry/sample-modules/ai-native/ai.back.service.ts # Search for the implementation of `requestCompletion` and `reportCompletion` in the mentioned files rg 'requestCompletion' packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts rg 'reportCompletion' packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts # Search for the implementation of `requestCompletion` and `reportCompletion` in the mentioned files rg 'requestCompletion' packages/core-common/src/types/ai-native/index.ts rg 'reportCompletion' packages/core-common/src/types/ai-native/index.tsLength of output: 973
a052b60
to
1c33fef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range, codebase verification and nitpick comments (4)
packages/core-node/src/ai-native/base-back.service.ts (1)
验证移除
reportCompletion
方法的影响
reportCompletion
方法在以下文件中有使用:
packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
packages/core-common/src/types/ai-native/index.ts
请确保在移除该方法后,更新这些文件中的相关代码以保持代码库的功能完整性。
Analysis chain
Line range hint
1-1
:
验证移除reportCompletion
方法的影响
reportCompletion
方法的移除简化了类接口,但可能会影响依赖此方法的组件。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of removing `reportCompletion` method. # Test: Search for the usage of `reportCompletion` method. Expect: No occurrences. rg --type python -A 5 $'reportCompletion'Length of output: 71
Script:
#!/bin/bash # Description: Verify the impact of removing `reportCompletion` method. # Test: Search for the usage of `reportCompletion` method. Expect: No occurrences. rg --type typescript -A 5 $'reportCompletion'Length of output: 79
Script:
#!/bin/bash # Description: Verify the impact of removing `reportCompletion` method. # Test: Search for the usage of `reportCompletion` method. Expect: No occurrences. rg --type ts -A 5 $'reportCompletion'Length of output: 1930
packages/startup/entry/sample-modules/ai-native/ai-native.contribution.ts (3)
419-421
: 改进代码:取消控制器的使用取消控制器的使用是一个好的实践,但可以考虑将其封装到一个单独的函数中,以提高代码的可读性和可维护性。
426-437
: 改进注释:更详细地描述函数功能当前注释过于简单,建议提供更详细的描述,以便其他开发人员更容易理解代码的意图。
- /** - * mock randown - */ + /** + * 生成指定长度的随机字符串 + * @param {number} length - 随机字符串的长度 + * @returns {string} - 生成的随机字符串 + */
449-457
: 改进代码:封装异步操作将异步操作封装到一个单独的函数中,以提高代码的可读性和可维护性。
+ const delay = (ms, signal) => new Promise((resolve, reject) => { + const timeout = setTimeout(resolve, ms); + signal.addEventListener('abort', () => { + clearTimeout(timeout); + reject(new DOMException('Aborted', 'AbortError')); + }); + }); try { await delay(1000, signal);
packages/startup/entry/sample-modules/ai-native/ai-native.contribution.ts
Show resolved
Hide resolved
packages/startup/entry/sample-modules/ai-native/ai-native.contribution.ts
Show resolved
Hide resolved
packages/startup/entry/sample-modules/ai-native/ai-native.contribution.ts
Show resolved
Hide resolved
1c33fef
to
3022944
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 7
Outside diff range, codebase verification and nitpick comments (8)
packages/ai-native/src/browser/contrib/intelligent-completions/intelligent-completions.feature.registry.ts (1)
1-2
: 考虑模块化导入。如果
@opensumi/di
和@opensumi/ide-core-common
提供了更多的导出项,可以考虑只导入需要的模块以优化性能。packages/core-node/src/ai-native/base-back.service.ts (1)
移除方法的影响需要验证
requestCompletion
和reportCompletion
方法在多个文件中仍有引用。请确保所有依赖这些方法的组件已根据新的架构进行更新。
packages/startup/entry/sample-modules/ai-native/ai.back.service.ts
中的requestCompletion
packages/core-common/src/types/ai-native/index.ts
中的requestCompletion
和reportCompletion
packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
中的相关引用请检查这些文件并更新依赖关系以适应方法的移除。
Analysis chain
Line range hint
10-10
:
移除requestCompletion
和reportCompletion
方法。这些方法的移除可能会影响依赖它们的其他组件。请确保相关依赖已更新以适应新的架构。
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of removing `requestCompletion` and `reportCompletion`. # Test: Search for any usage of the removed methods. Expect: No occurrences. rg --type ts 'requestCompletion|reportCompletion'Length of output: 1007
packages/core-common/src/types/ai-native/index.ts (3)
96-98
: 需要迁移到新接口IIntelligentCompletionsResult
在多个文件中仍然发现了对已过时接口
IAICompletionResultModel
的引用。建议将这些引用迁移到新的接口IIntelligentCompletionsResult
。
packages/core-common/src/types/ai-native/index.ts
packages/ai-native/src/browser/types.ts
packages/ai-native/src/browser/contrib/inline-completions/model/inlineCompletionRequestTask.ts
packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
请确保更新所有相关代码以使用新的接口。
Analysis chain
标记为过时的接口
IAICompletionResultModel
接口已标记为过时,建议使用IIntelligentCompletionsResult
。确保所有相关代码都迁移到新的接口。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of deprecated `IAICompletionResultModel` interface. # Test: Search for references to `IAICompletionResultModel`. Expect: No references or only in deprecated contexts. rg --type typescript 'IAICompletionResultModel'Length of output: 82
Script:
#!/bin/bash # Description: Verify usage of deprecated `IAICompletionResultModel` interface. # Test: Search for references to `IAICompletionResultModel`. Expect: No references or only in deprecated contexts. rg 'IAICompletionResultModel'Length of output: 1110
167-169
: 发现对过时方法requestCompletion
的引用在代码库中仍然存在对
requestCompletion
方法的引用。请确保将这些引用更新为使用新的registerIntelligentCompletionFeature
API。
packages/startup/entry/sample-modules/ai-native/ai.back.service.ts
: 定义了requestCompletion
方法。packages/core-common/src/types/ai-native/index.ts
: 声明了requestCompletion
方法。packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
: 使用了requestCompletion
方法。请更新这些位置以使用新的 API。
Analysis chain
标记为过时的方法
requestCompletion
方法已标记为过时,建议使用registerIntelligentCompletionFeature
API。确保所有调用此方法的代码都更新为使用新的 API。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of deprecated `requestCompletion` method. # Test: Search for references to `requestCompletion`. Expect: No references or only in deprecated contexts. rg --type typescript 'requestCompletion'Length of output: 75
Script:
#!/bin/bash # Description: Verify usage of deprecated `requestCompletion` method. # Test: Search for references to `requestCompletion`. Expect: No references or only in deprecated contexts. rg --type ts 'requestCompletion'Length of output: 576
174-176
:reportCompletion
方法仍在使用尽管
reportCompletion
方法已被标记为过时,但它仍在以下位置使用:
packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
: 在条件检查和方法调用中。建议检查是否有计划中的替代方案或功能调整,以便在未来版本中移除对该方法的依赖。请提供替代方案或更新文档以指导开发者进行迁移。
Analysis chain
标记为过时的方法
reportCompletion
方法已标记为过时,但没有提供具体的替代方案。需要确认是否有计划中的替代方案或功能调整。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of deprecated `reportCompletion` method. # Test: Search for references to `reportCompletion`. Expect: No references or only in deprecated contexts. rg --type typescript 'reportCompletion'Length of output: 74
Script:
#!/bin/bash # Description: Verify usage of deprecated `reportCompletion` method. # Test: Search for references to `reportCompletion`. Expect: No references or only in deprecated contexts. rg --type ts 'reportCompletion'Length of output: 443
packages/ai-native/src/browser/types.ts (1)
259-261
: 过时类型仍在使用
IProvideInlineCompletionsSignature
类型仍然在packages/ai-native/src/browser/types.ts
中定义并使用。请确保所有相关代码迁移到新的registerIntelligentCompletionProvider
API。
packages/ai-native/src/browser/types.ts
:IProvideInlineCompletionsSignature
类型定义及使用Analysis chain
标记为过时的类型
IProvideInlineCompletionsSignature
类型已标记为过时,建议使用registerIntelligentCompletionProvider
API。确保所有相关代码都迁移到新的 API。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify usage of deprecated `IProvideInlineCompletionsSignature` type. # Test: Search for references to `IProvideInlineCompletionsSignature`. Expect: No references or only in deprecated contexts. rg --type typescript 'IProvideInlineCompletionsSignature'Length of output: 92
Script:
#!/bin/bash # Description: Verify usage of deprecated `IProvideInlineCompletionsSignature` type. # Test: Search for references to `IProvideInlineCompletionsSignature`. Expect: No references or only in deprecated contexts. rg 'IProvideInlineCompletionsSignature' --glob '*.ts' -A 3Length of output: 523
packages/ai-native/src/browser/contrib/inline-completions/model/inlineCompletionRequestTask.ts (1)
186-264
: 提高代码可读性:在pushLineCompletions
方法中使用更具描述性的变量名建议使用更具描述性的变量名来提高代码的可读性。例如,将
codeModel
改为completionItem
。- for (const codeModel of completeResult.items) { - const contentText = codeModel.insertText.toString(); + for (const completionItem of completeResult.items) { + const contentText = completionItem.insertText.toString();packages/ai-native/src/browser/contrib/intelligent-completions/multi-line.decoration.ts (1)
73-88
: 重命名方法以提高可读性建议将
combineContinuousMods
方法重命名为combineContinuousModifications
以提高代码可读性。- private combineContinuousMods(changes: IModificationsInline[]) { + private combineContinuousModifications(changes: IModificationsInline[]) {
packages/ai-native/src/browser/contrib/intelligent-completions/diff-computer.ts
Show resolved
Hide resolved
packages/ai-native/src/browser/contrib/inline-completions/model/inlineCompletionRequestTask.ts
Show resolved
Hide resolved
...ges/ai-native/src/browser/contrib/intelligent-completions/intelligent-completions.handler.ts
Outdated
Show resolved
Hide resolved
packages/ai-native/src/browser/contrib/intelligent-completions/multi-line.decoration.ts
Show resolved
Hide resolved
...ges/ai-native/src/browser/contrib/intelligent-completions/intelligent-completions.handler.ts
Outdated
Show resolved
Hide resolved
packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
Show resolved
Hide resolved
packages/startup/entry/sample-modules/ai-native/ai-native.contribution.ts
Outdated
Show resolved
Hide resolved
3022944
to
c3829a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
packages/core-node/src/ai-native/base-back.service.ts (1)
确认删除方法的影响
在代码库中发现了
requestCompletion
和reportCompletion
方法的使用。这些方法的移除可能会影响依赖它们的功能。请手动检查以下文件以确保没有未处理的依赖项或调用:
packages/startup/entry/sample-modules/ai-native/ai.back.service.ts
packages/core-common/src/types/ai-native/index.ts
packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
Analysis chain
Line range hint
10-20
:
确认删除方法的影响
requestCompletion
和reportCompletion
方法被移除,可能会影响依赖这些方法的组件或服务。请确保在代码库中没有未处理的依赖项或调用。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify no remaining dependencies on removed methods in the codebase. # Test: Search for any usage of the removed methods. Expect: No occurrences. rg --type ts 'requestCompletion|reportCompletion'Length of output: 1007
c3829a2
to
6278f4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
packages/core-node/src/ai-native/base-back.service.ts (1)
移除方法的影响需要验证
requestCompletion
和reportCompletion
方法在以下文件中仍有引用,可能会影响代码库的功能:
packages/startup/entry/sample-modules/ai-native/ai.back.service.ts
packages/core-common/src/types/ai-native/index.ts
packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
请确保这些方法的移除不会破坏相关功能,或者用新的实现替代它们。
Analysis chain
Line range hint
1-22
: 请验证移除的方法对代码库的影响。
requestCompletion
和reportCompletion
方法的移除可能会影响依赖这些方法的其他组件。请确保在整个代码库中没有对这些方法的调用,或者已经用新的实现替代。Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that removed methods are not called elsewhere in the codebase. # Test: Search for any usage of the removed methods. Expect: No occurrences found. rg --type typescript 'requestCompletion|reportCompletion'Length of output: 94
Script:
#!/bin/bash # Description: Verify that removed methods are not called elsewhere in the codebase. # Test: Search for any usage of the removed methods in TypeScript files. Expect: No occurrences found. rg 'requestCompletion|reportCompletion' --glob '*.ts'Length of output: 1011
af9889f
to
6b35cae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (1)
packages/core-node/src/ai-native/base-back.service.ts (1)
确认移除方法的影响
在代码库中仍然存在对
requestCompletion
和reportCompletion
方法的引用。请确保更新或移除这些引用,以防止代码错误。
packages/startup/entry/sample-modules/ai-native/ai.back.service.ts
packages/core-common/src/types/ai-native/index.ts
packages/ai-native/src/browser/contrib/inline-completions/service/ai-completions.service.ts
请手动验证这些更改对代码库的影响。
Analysis chain
Line range hint
10-10
: 确认移除方法的影响。
requestCompletion
和reportCompletion
方法的移除可能会影响依赖这些方法的其他组件。请确保在代码库中已更新相关调用。Also applies to: 14-14
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the removal of `requestCompletion` and `reportCompletion` methods does not break the codebase. # Test: Search for any remaining references to the removed methods. rg --type typescript 'requestCompletion|reportCompletion'Length of output: 94
Script:
#!/bin/bash # Description: Verify that the removal of `requestCompletion` and `reportCompletion` methods does not break the codebase. # Test: Search for any remaining references to the removed methods using the correct file extension for TypeScript. rg 'requestCompletion|reportCompletion' --glob '*.ts'Length of output: 1011
packages/ai-native/src/browser/contrib/inline-completions/inline-completions.handler.ts
Outdated
Show resolved
Hide resolved
* chore: implement intelligent completions api * chore: implement diff algorithm * feat: handle diff result decoration render * chore: improve trigger * chore: add tests * feat: support accept & esc * refactor: inline completion provider * feat: add context bean * fix: ci * fix: ci * feat: improve code * chore: use enableMultiLine
Types
Background or solution
用法示例
multi_line.mp4
Changelog
Summary by CodeRabbit
Summary by CodeRabbit
新功能
文档