Skip to content
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

refactor: inline completions #3186

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

Ricbet
Copy link
Member

@Ricbet Ricbet commented Nov 17, 2023

Types

  • 🎉 New Features

Background or solution

🤖[deprecated] Generated by Copilot at 05dd768

  • Implement a new inline-completions module for providing code suggestions for TypeScript files in the AI editor (link, link, link, link, link)
  • Define the TypeScriptCompletionsProvider class that implements the monaco.languages.InlineCompletionsProvider interface and handles the logic of sending and processing the completion requests (link)
  • Define the interfaces and types related to the completion model, such as CodeModel, CompletionRequestBean, CompletionResultModel, and InlineCompletionItem (link)
  • Define the PromptCache class that implements a simple cache mechanism for storing and retrieving the completion results based on the prompt hash (link)
  • Define the AiCompletionsService class that wraps the aiBackService and provides a method for sending the completion requests to the backend (link)
  • Define some constants and functions related to the message that is shown to the user when a completion is suggested (link)
  • Refactor the AiEditorContribution class in ai-editor.contribution.ts to use the new inline-completions module and simplify the code (link, link, link, link)
    • Import the TypeScriptCompletionsProvider class from the inline-completions module and use it to provide inline code completions for TypeScript files (link)
    • Remove the cancelRequest function and the variables related to it from the AiEditorContribution class and move the logic of canceling the completion requests to the TypeScriptCompletionsProvider class (link)
    • Simplify the provideInlineCompletions function of the AiEditorContribution class by delegating the logic of generating the completion items to the inlineCompleteProvider instance (link)
    • Add a return statement to the end of the AiEditorContribution constructor to make the code more consistent and explicit (link)

Changelog

🤖[deprecated] Generated by Copilot at 05dd768

This pull request adds a new inline-completions module to the ai-native package, which provides a modular and improved implementation of the AI code completion feature for TypeScript files. It defines new classes, interfaces, types, and services for the completion provider, the completion model, the prompt cache, and the message display. It also refactors the AI editor contribution module to use the new inline-completions module.

@Ricbet Ricbet self-assigned this Nov 17, 2023
@opensumi opensumi bot added ⚙️ refactor Refactor code 🎨 feature feature required labels Nov 17, 2023
@Ricbet Ricbet merged commit fdd2ccd into chore/ai-native-module Nov 17, 2023
5 checks passed
@Ricbet Ricbet deleted the refactor/inline-completions branch November 17, 2023 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 feature feature required ⚙️ refactor Refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant