Skip to content

Metered network connection fixes#298383

Draft
dmitrivMS wants to merge 5 commits intomainfrom
dev/dmitriv/metered-connections-fixes
Draft

Metered network connection fixes#298383
dmitrivMS wants to merge 5 commits intomainfrom
dev/dmitriv/metered-connections-fixes

Conversation

@dmitrivMS
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
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

Adds metered-network awareness to inline completions providers (opt-out via metadata) and extends telemetry to respect metered connections, ensuring network-heavy features can be suppressed when the connection is metered.

Changes:

  • Introduces usesNetworkRequests?: boolean for inline completions provider metadata / provider definitions and wires it through the ext host ↔ main thread registration pipeline.
  • Filters inline completions providers when IMeteredConnectionService.isConnectionMetered is true.
  • Plumbs IMeteredConnectionService into workbench telemetry and updates test/fixture service setups to include the new service.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts Adds proposed API metadata flag usesNetworkRequests (defaulting to true).
src/vs/monaco.d.ts Adds usesNetworkRequests to Monaco inline completions provider definition.
src/vs/editor/common/languages.ts Adds usesNetworkRequests to the internal InlineCompletionsProvider interface.
src/vs/workbench/api/common/extHostLanguageFeatures.ts Sends usesNetworkRequests (default true) over the ext host protocol during inline completions provider registration.
src/vs/workbench/api/common/extHost.protocol.ts Extends $registerInlineCompletionsSupport signature with usesNetworkRequests.
src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts Accepts and stores usesNetworkRequests on the extension-backed inline completions provider.
src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.ts Skips providers marked as using network requests when the connection is metered.
src/vs/workbench/services/telemetry/electron-browser/telemetryService.ts Injects IMeteredConnectionService and passes it into the base telemetry service config.
src/vs/platform/telemetry/common/telemetryService.ts Ensures buffered events flush through _log (so metered filtering applies at flush time).
src/vs/workbench/test/browser/componentFixtures/fixtureUtils.ts Adds an IMeteredConnectionService test stub to fixture service wiring.
src/vs/editor/contrib/inlineCompletions/test/browser/utils.ts Adds an IMeteredConnectionService test stub to inline completions test harness wiring.

Comment on lines +473 to +482
const isMetered = this._meteredConnectionService.isConnectionMetered;

const availableProviders: InlineCompletionsProvider[] = [];
for (const provider of unsuppressedProviders) {
if (provider.groupId && excludedGroupIds.has(provider.groupId)) {
continue;
}
if (isMetered && provider.usesNetworkRequests) {
continue;
}
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

This introduces new behavior (skipping providers on metered connections when usesNetworkRequests is true), but there doesn't appear to be a test asserting that providers are filtered correctly when IMeteredConnectionService.isConnectionMetered is true. Consider adding a unit test that stubs IMeteredConnectionService to true and verifies a provider with usesNetworkRequests: true is not queried (and one with usesNetworkRequests: false still is).

Copilot uses AI. Check for mistakes.
@dmitrivMS dmitrivMS added the network Network related issues label Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

network Network related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants