Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Inline completions in @vscode/chat-lib#2131

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
chrmarti merged 19 commits intomainfromjeffreyhunter77/chat-lib-inline-completions
Nov 21, 2025

Conversation

@jeffreyhunter77
Copy link
Collaborator

Include inline completions in @vscode/chat-lib

This exports a function for creating anIInlineCompletionsProvider:

functioncreateInlineCompletionsProvider(options:IInlineCompletionsProviderOptions):IInlineCompletionsProvider

The returned instance provides methods for updating treatment variables and getting inline completions:

exportinterfaceIInlineCompletionsProvider{updateTreatmentVariables(variables:Record<string,boolean|number|string>):void;getInlineCompletions(textDocument:ITextDocument,position:Position,token?:CancellationToken,options?:IGetInlineCompletionsOptions):Promise<CopilotCompletion[]|undefined>;dispose():void;}

The options object for creating a provider is fairly complex. It allows for customizing much of what was previously passed in to the completions function via aContext object. This is probably a good area for simplifying in future iterations.

I also discovered an undeclared dependency that I've added to the mainpackage.json. Some of thecompletions code depends on@sinclair/typebox. That's being indirectly supplied by@vitest/snapshot right now, but it we should have an explicit dependency. I'm using the same version as the completions extension here.

devm33 reacted with hooray emoji
chrmartiand others added17 commitsNovember 21, 2025 11:39
…s of chat-lib and add missing completions dependencies
CopilotAI review requested due to automatic review settingsNovember 21, 2025 10:54
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull Request Overview

This PR integrates inline completions functionality into the @vscode/chat-lib package, making it available for external consumption. The main purpose is to export acreateInlineCompletionsProvider function that allows consumers to create inline completion providers with extensive customization options.

Key changes:

  • Exports inline completions provider creation functionality throughchatLibMain.ts
  • Refactors service dependencies to support chat-lib usage (removes direct VS Code API dependencies)
  • Enhances the build system to handle path aliases and improved dependency tracking
  • Adds comprehensive test coverage for the new inline completions API

Reviewed Changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/platform/telemetry/node/azureInsightsReporter.tsExportsunwrapEventNameFromPrefix function for telemetry event name normalization in chat-lib
src/lib/node/chatLibMain.tsMain integration point: exports inline completions provider creation with extensive service setup and bridging
src/extension/completions-core/vscode-node/prompt/src/fileLoader.tsImproves path resolution to work correctly in both TypeScript source and transpiled JavaScript contexts
src/extension/completions-core/vscode-node/lib/src/telemetry/userConfig.tsEnsures telemetry user config is initialized immediately when copilot token is already available
src/extension/completions-core/vscode-node/lib/src/notificationSender.tsRemoves direct VS Code API dependency, uses injected notification service instead
src/extension/completions-core/vscode-node/lib/src/error/userErrorNotifier.tsRemoves direct VS Code API dependency, uses injected env service instead
src/extension/completions-core/vscode-node/lib/src/config.tsExportsEditorInfo andEditorPluginInfo types for chat-lib API surface
src/extension/completions-core/vscode-node/lib/src/completionsObservableWorkspace.tsRemoves implementation, keeps only interface definition to avoid circular dependencies
src/extension/completions-core/vscode-node/extension/src/completionsObservableWorkspace.tsMovesCompletionsObservableWorkspace implementation to extension-specific location
src/extension/completions-core/vscode-node/completionsServiceBridges.tsUpdates import path for movedCompletionsObservableWorkspace class and fixes service descriptor
script/build/extractChatLib.tsSignificantly enhances build script to handle path aliases, JSX imports, and improved comment filtering
package.jsonAdds explicit dependency on@sinclair/typebox (previously transitive)
eslint.config.mjsDisables restricted import paths rule for chatLibMain.ts to allow cross-boundary imports
chat-lib/vitest.config.tsRemoves unused path import
chat-lib/tsconfig.jsonAdds empty paths object (populated by build script)
chat-lib/test/getInlineCompletions.spec.tsComprehensive test for inline completions provider functionality
chat-lib/test/getInlineCompletions.reply.txtTest fixture containing mock completion response data
chat-lib/script/postinstall.tsNew script to copy static assets (tiktoken files and tree-sitter grammars) after installation
chat-lib/package.jsonAdds required dependencies and postinstall script
Files not reviewed (1)
  • chat-lib/package-lock.json: Language not supported

Comment on lines +510 to +512
if(this._telemetrySender.sendEnhancedTelemetryEvent){
this._telemetrySender.sendEnhancedTelemetryEvent(eventName,eventPropertiesToSimpleObject(properties),measurements);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The implementation should avoid creating adhoc one-off mocks. Consider creating a reusableMockTelemetrySender class under atest/ folder that can be configured for different test scenarios, similar to existing patterns likeMockFileSystemService.

Copilot generated this review using guidance fromrepository custom instructions.
// Track block comments
if(line.trim().startsWith('/*')){
// preserve pragmas in tsx files
if(!(filePath.endsWith('.tsx')&&line.match(/\/\*\*\s+@jsxImportSource\s+\S+/))){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The regex pattern for JSX import source appears twice (here and at line 233). Extract this into a named constant to avoid duplication and improve maintainability.

Copilot uses AI. Check for mistakes.

}

main();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The main function call should handle errors. If the async operation fails, the postinstall script will silently succeed. Add.catch(err => { console.error(err); process.exit(1); }) to properly propagate errors.

Copilot uses AI. Check for mistakes.
@jeffreyhunter77
Copy link
CollaboratorAuthor

@microsoft-github-policy-service agree company="GitHub"

Copy link
Collaborator

@chrmartichrmarti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM!

@vs-code-engineeringvs-code-engineeringbot added this to theNovember 2025 milestoneNov 21, 2025
@chrmartichrmarti added this pull request to themerge queueNov 21, 2025
Merged via the queue intomain with commit6be35c3Nov 21, 2025
16 checks passed
@chrmartichrmarti deleted the jeffreyhunter77/chat-lib-inline-completions branchNovember 21, 2025 16:00
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@chrmartichrmartichrmarti approved these changes

Assignees

@chrmartichrmarti

Projects

None yet

Milestone

November 2025

Development

Successfully merging this pull request may close these issues.

2 participants

@jeffreyhunter77@chrmarti

[8]ページ先頭

©2009-2025 Movatter.jp