Skip to content

Conversation

@przpl
Copy link
Contributor

@przpl przpl commented Jan 4, 2026

See this PR to understand why this feature may be needed: microsoft/vscode-copilot-chat#2698

Introduces a new proposed API and supporting infrastructure for providing AI completions inline within the chat input editor. This includes:

  • A new chatInlineCompletions extension API proposal
  • Extension host protocol and implementation for managing inline completions
  • Browser-side services for handling completion rendering and interactions
  • Integration with the chat input editor
  • This PR lays the foundation for external chat providers to offer intelligent code completion suggestions within chat conversations.

Copy link
Contributor

Copilot AI 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 introduces support for AI-powered inline completions within the chat input editor through a new proposed API. It provides infrastructure for extensions to offer intelligent completion suggestions as users type in chat conversations.

Key Changes

  • New chatInlineCompletions proposed API enabling extensions to register inline completion providers for chat input
  • Service layer implementation for aggregating completions from multiple providers
  • RPC protocol infrastructure for extension host communication
  • Integration with the chat input editor via InlineCompletionsController

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vscode-dts/vscode.proposed.chatInlineCompletions.d.ts New API proposal defining ChatInlineCompletionItemProvider interface and registration method
src/vs/workbench/contrib/chat/common/chatInlineCompletionsService.ts Service interface for managing chat inline completion providers
src/vs/workbench/contrib/chat/browser/chatInlineCompletionsService.ts Browser service implementation that aggregates completions from registered providers
src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.ts ChatInputInlineCompletions contribution that bridges service to editor's inline completion infrastructure
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts Adds InlineCompletionsController to chat input editor contributions
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Registers ChatInlineCompletionsService singleton
src/vs/workbench/api/common/extHostChatInlineCompletions.ts Extension host implementation managing provider registration and type conversion
src/vs/workbench/api/common/extHost.protocol.ts RPC protocol shape definitions for main/extension thread communication
src/vs/workbench/api/common/extHost.api.impl.ts Exposes registerChatInlineCompletionItemProvider API to extensions
src/vs/workbench/api/browser/mainThreadChatInlineCompletions.ts Main thread coordinator delegating to service layer
src/vs/workbench/api/browser/extensionHost.contribution.ts Imports main thread coordinator for initialization
src/vs/platform/extensions/common/extensionsApiProposals.ts Registers chatInlineCompletions as available API proposal

Comment on lines 1269 to 1315
class ChatInputInlineCompletions extends Disposable {
private readonly _ourProvider: InlineCompletionsProvider;

constructor(
@ILanguageFeaturesService private readonly languageFeaturesService: ILanguageFeaturesService,
@IChatWidgetService private readonly chatWidgetService: IChatWidgetService,
@IChatInlineCompletionsService private readonly chatInlineCompletionsService: IChatInlineCompletionsService,
) {
super();

this._ourProvider = {
debounceDelayMs: 150, // prevents excessive provider calls during rapid typing.
provideInlineCompletions: async (model: ITextModel, position: Position, _context: InlineCompletionContext, token: CancellationToken): Promise<InlineCompletions | undefined> => {
const widget = this.chatWidgetService.getWidgetByInputUri(model.uri);
if (!widget || !widget.viewModel) {
return undefined;
}

// Only show suggestions at end of line with non-empty content.
const lineContent = model.getLineContent(position.lineNumber);
// Column is 1-based, so subtract 1 to compare with 0-based line length
const isAtEndOfLine = position.column - 1 === lineContent.length;

if (!isAtEndOfLine || lineContent.trim().length < 3) {
return undefined;
}

// Call chat-specific inline completion providers
const input = model.getValue();
const cursorPosition = model.getOffsetAt(position);

const result = await this.chatInlineCompletionsService.provideChatInlineCompletions(
input,
cursorPosition,
token
);

return result;
},
disposeInlineCompletions: () => { },
};

this._register(this.languageFeaturesService.inlineCompletionsProvider.register({ scheme: Schemas.vscodeChatInput, hasAccessToAllModels: true }, this._ourProvider));
}
}

Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ChatInputInlineCompletions, LifecyclePhase.Eventually);
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

This PR introduces a new proposed API and significant functionality but lacks any test coverage. The repository has comprehensive test suites for similar API features (e.g., mainThreadChatSessions.test.ts, extHostLanguageFeatures.test.ts). Consider adding tests for: provider registration/unregistration, completion item conversion, error handling in the service aggregation, and the RPC protocol between extension host and main thread.

Copilot uses AI. Check for mistakes.
@przpl przpl marked this pull request as ready for review January 5, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants