Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: vscode-accessibility
description: Use when creating new UI or updating existing UI features. Accessibility guidelines for VS Code features — covers accessibility help dialogs, accessible views, verbosity settings, accessibility signals, ARIA alerts/status announcements, keyboard navigation, and ARIA labels/roles. Applies to both new interactive UI surfaces and updates to existing features.
name: accessibility
description: Accessibility guidelines for VS Code features — covers accessibility help dialogs, accessible views, verbosity settings, accessibility signals, ARIA alerts/status announcements, keyboard navigation, and ARIA labels/roles. Applies to both new interactive UI surfaces and updates to existing features. Use when creating new UI or updating existing UI features.
---

When adding a **new interactive UI surface** to VS Code — a panel, view, widget, editor overlay, dialog, or any rich focusable component the user interacts with — you **must** provide three accessibility components (if they do not already exist for the feature):
Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ export default tseslint.config(
'src/vs/platform/log/common/log.ts',
'src/vs/platform/log/common/logIpc.ts',
'src/vs/platform/log/electron-main/logIpc.ts',
'src/vs/platform/meteredConnection/electron-main/meteredConnectionChannel.ts',
'src/vs/platform/observable/common/wrapInHotClass.ts',
'src/vs/platform/observable/common/wrapInReloadableClass.ts',
'src/vs/platform/policy/common/policyIpc.ts',
Expand Down
1 change: 1 addition & 0 deletions extensions/git/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"contribSourceControlTitleMenu",
"contribViewsWelcome",
"editSessionIdentityProvider",
"envIsConnectionMetered",
"findFiles2",
"quickDiffProvider",
"quickPickSortByLabel",
Expand Down
7 changes: 7 additions & 0 deletions extensions/git/src/autofetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export class AutoFetcher {
const onGoodRemoteOperation = filterEvent(repository.onDidRunOperation, ({ operation, error }) => !error && operation.remote);
const onFirstGoodRemoteOperation = onceEvent(onGoodRemoteOperation);
onFirstGoodRemoteOperation(this.onFirstGoodRemoteOperation, this, this.disposables);

env.onDidChangeMeteredConnection(() => this.onConfiguration(), this, this.disposables);
}

private async onFirstGoodRemoteOperation(): Promise<void> {
Expand Down Expand Up @@ -66,6 +68,11 @@ export class AutoFetcher {
return;
}

if (env.isMeteredConnection) {
this.disable();
return;
}

const gitConfig = workspace.getConfiguration('git', Uri.file(this.repository.root));
switch (gitConfig.get<boolean | 'all'>('autofetch')) {
case true:
Expand Down
1 change: 1 addition & 0 deletions extensions/git/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"../../src/vscode-dts/vscode.proposed.canonicalUriProvider.d.ts",
"../../src/vscode-dts/vscode.proposed.findFiles2.d.ts",
"../../src/vscode-dts/vscode.proposed.editSessionIdentityProvider.d.ts",
"../../src/vscode-dts/vscode.proposed.envIsConnectionMetered.d.ts",
"../../src/vscode-dts/vscode.proposed.quickDiffProvider.d.ts",
"../../src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts",
"../../src/vscode-dts/vscode.proposed.scmActionButton.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion extensions/theme-2026/themes/2026-dark.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "dark",
"colors": {
"foreground": "#bfbfbf",
"disabledForeground": "#444444",
"disabledForeground": "#666666",
"errorForeground": "#f48771",
"descriptionForeground": "#999999",
"icon.foreground": "#888888",
Expand Down
1 change: 1 addition & 0 deletions extensions/vscode-api-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"editorInsets",
"embeddings",
"envIsAppPortable",
"envIsConnectionMetered",
"extensionRuntime",
"extensionsAny",
"externalUriOpener",
Expand Down
18 changes: 18 additions & 0 deletions src/vs/code/electron-main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ import { ILifecycleMainService, LifecycleMainPhase, ShutdownReason } from '../..
import { ILoggerService, ILogService } from '../../platform/log/common/log.js';
import { IMenubarMainService, MenubarMainService } from '../../platform/menubar/electron-main/menubarMainService.js';
import { INativeHostMainService, NativeHostMainService } from '../../platform/native/electron-main/nativeHostMainService.js';
import { IMeteredConnectionService } from '../../platform/meteredConnection/common/meteredConnection.js';
import { METERED_CONNECTION_CHANNEL } from '../../platform/meteredConnection/common/meteredConnectionIpc.js';
import { MeteredConnectionChannel } from '../../platform/meteredConnection/electron-main/meteredConnectionChannel.js';
import { MeteredConnectionMainService } from '../../platform/meteredConnection/electron-main/meteredConnectionMainService.js';
import { IProductService } from '../../platform/product/common/productService.js';
import { getRemoteAuthority } from '../../platform/remote/common/remoteHosts.js';
import { SharedProcess } from '../../platform/sharedProcess/electron-main/sharedProcess.js';
Expand Down Expand Up @@ -589,6 +593,11 @@ export class CodeApplication extends Disposable {
// Error telemetry
appInstantiationService.invokeFunction(accessor => this._register(new ErrorTelemetry(accessor.get(ILogService), accessor.get(ITelemetryService))));

// Metered connection telemetry
appInstantiationService.invokeFunction(accessor => {
(accessor.get(IMeteredConnectionService) as MeteredConnectionMainService).setTelemetryService(accessor.get(ITelemetryService));
});

// Auth Handler
appInstantiationService.invokeFunction(accessor => accessor.get(IProxyAuthService));

Expand Down Expand Up @@ -1039,6 +1048,10 @@ export class CodeApplication extends Disposable {
// Native Host
services.set(INativeHostMainService, new SyncDescriptor(NativeHostMainService, undefined, false /* proxied to other processes */));

// Metered Connection
const meteredConnectionService = new MeteredConnectionMainService(this.configurationService);
services.set(IMeteredConnectionService, meteredConnectionService);

// Web Contents Extractor
services.set(IWebContentExtractorService, new SyncDescriptor(NativeWebContentExtractorService, undefined, false /* proxied to other processes */));

Expand Down Expand Up @@ -1168,6 +1181,11 @@ export class CodeApplication extends Disposable {
const updateChannel = new UpdateChannel(accessor.get(IUpdateService));
mainProcessElectronServer.registerChannel('update', updateChannel);

// Metered Connection
const meteredConnectionChannel = new MeteredConnectionChannel(accessor.get(IMeteredConnectionService) as MeteredConnectionMainService);
mainProcessElectronServer.registerChannel(METERED_CONNECTION_CHANNEL, meteredConnectionChannel);
sharedProcessClient.then(client => client.registerChannel(METERED_CONNECTION_CHANNEL, meteredConnectionChannel));

// Process
const processChannel = ProxyChannel.fromService(new ProcessMainService(this.logService, accessor.get(IDiagnosticsService), accessor.get(IDiagnosticsMainService)), disposables);
mainProcessElectronServer.registerChannel('process', processChannel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ import { McpManagementChannel } from '../../../platform/mcp/common/mcpManagement
import { AllowedMcpServersService } from '../../../platform/mcp/common/allowedMcpServersService.js';
import { IMcpGalleryManifestService } from '../../../platform/mcp/common/mcpGalleryManifest.js';
import { McpGalleryManifestIPCService } from '../../../platform/mcp/common/mcpGalleryManifestServiceIpc.js';
import { IMeteredConnectionService } from '../../../platform/meteredConnection/common/meteredConnection.js';
import { MeteredConnectionChannelClient, METERED_CONNECTION_CHANNEL } from '../../../platform/meteredConnection/common/meteredConnectionIpc.js';

class SharedProcessMain extends Disposable implements IClientConnectionFilter {

Expand Down Expand Up @@ -295,6 +297,10 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {
const nativeHostService = new NativeHostService(-1 /* we are not running in a browser window context */, mainProcessService) as INativeHostService;
services.set(INativeHostService, nativeHostService);

// Metered Connection
const meteredConnectionService = this._register(new MeteredConnectionChannelClient(mainProcessService.getChannel(METERED_CONNECTION_CHANNEL)));
services.set(IMeteredConnectionService, meteredConnectionService);

// Download
services.set(IDownloadService, new SyncDescriptor(DownloadService, undefined, true));

Expand All @@ -321,6 +327,7 @@ class SharedProcessMain extends Disposable implements IClientConnectionFilter {
commonProperties: resolveCommonProperties(release(), hostname(), process.arch, productService.commit, productService.version, this.configuration.machineId, this.configuration.sqmId, this.configuration.devDeviceId, internalTelemetry, productService.date),
sendErrorTelemetry: true,
piiPaths: getPiiPathsFromEnvironment(environmentService),
meteredConnectionService,
}, configurationService, productService);
} else {
telemetryService = NullTelemetryService;
Expand Down
9 changes: 9 additions & 0 deletions src/vs/platform/actions/browser/menuEntryActionViewItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
background-size: 16px;
}

.monaco-dropdown-with-default > .action-container.disabled {
cursor: default;
}

.monaco-dropdown-with-default > .action-container.disabled > .action-label {
opacity: 0.4;
pointer-events: none;
}

.monaco-dropdown-with-default:hover {
background-color: var(--vscode-toolbar-hoverBackground);
}
Expand Down
3 changes: 3 additions & 0 deletions src/vs/platform/extensions/common/extensionsApiProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ const _allApiProposals = {
envIsAppPortable: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envIsAppPortable.d.ts',
},
envIsConnectionMetered: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.envIsConnectionMetered.d.ts',
},
environmentPower: {
proposal: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.environmentPower.d.ts',
},
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/menubar/electron-main/menubar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ export class Menubar extends Disposable {
case StateType.AvailableForDownload:
return [new MenuItem({
label: this.mnemonicLabel(nls.localize('miDownloadUpdate', "D&&ownload Available Update")), click: () => {
this.updateService.downloadUpdate();
this.updateService.downloadUpdate(true);
}
})];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { toDisposable } from '../../../base/common/lifecycle.js';
import { IConfigurationService } from '../../configuration/common/configuration.js';
import { InstantiationType, registerSingleton } from '../../instantiation/common/extensions.js';
import { AbstractMeteredConnectionService, getIsBrowserConnectionMetered, IMeteredConnectionService, NavigatorWithConnection } from '../common/meteredConnection.js';

/**
* Browser implementation of the metered connection service.
* This implementation monitors navigator.connection for changes.
*/
export class MeteredConnectionService extends AbstractMeteredConnectionService {
constructor(@IConfigurationService configurationService: IConfigurationService) {
super(configurationService, getIsBrowserConnectionMetered());

const connection = (navigator as NavigatorWithConnection).connection;
if (connection) {
const onChange = () => this.setIsBrowserConnectionMetered(getIsBrowserConnectionMetered());
connection.addEventListener('change', onChange);
this._register(toDisposable(() => connection.removeEventListener('change', onChange)));
}
}
}

registerSingleton(IMeteredConnectionService, MeteredConnectionService, InstantiationType.Delayed);
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { localize } from '../../../nls.js';
import { ConfigurationScope, Extensions as ConfigurationExtensions, IConfigurationRegistry } from '../../configuration/common/configurationRegistry.js';
import { Registry } from '../../registry/common/platform.js';

const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
configurationRegistry.registerConfiguration({
id: 'network',
order: 14,
title: localize('networkConfigurationTitle', "Network"),
type: 'object',
properties: {
'network.respectMeteredConnections': {
type: 'boolean',
default: true,
scope: ConfigurationScope.APPLICATION,
description: localize('respectMeteredConnections', "When enabled, automatic updates and downloads will be postponed when on a metered network connection (such as mobile data or tethering)."),
tags: ['usesOnlineServices']
}
}
});
130 changes: 130 additions & 0 deletions src/vs/platform/meteredConnection/common/meteredConnection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Emitter, Event } from '../../../base/common/event.js';
import { Disposable } from '../../../base/common/lifecycle.js';
import { IConfigurationService } from '../../configuration/common/configuration.js';
import { createDecorator } from '../../instantiation/common/instantiation.js';

export const IMeteredConnectionService = createDecorator<IMeteredConnectionService>('meteredConnectionService');

/**
* Service to report on metered connection status.
*/
export interface IMeteredConnectionService {
readonly _serviceBrand: undefined;

/**
* Whether the current network connection is metered.
* Always returns `false` if the `network.respectMeteredConnections` setting is disabled.
*/
readonly isConnectionMetered: boolean;

/**
* Event that fires when the metered connection status changes.
*/
readonly onDidChangeIsConnectionMetered: Event<boolean>;
}

export const METERED_CONNECTION_SETTING_KEY = 'network.respectMeteredConnections';

/**
* Network Information API
* See https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API
*/
export interface NetworkInformation {
saveData?: boolean;
metered?: boolean;
effectiveType?: 'slow-2g' | '2g' | '3g' | '4g';
addEventListener(type: 'change', listener: () => void): void;
removeEventListener(type: 'change', listener: () => void): void;
}

/**
* Extended Navigator interface for Network Information API
*/
export interface NavigatorWithConnection {
readonly connection?: NetworkInformation;
}

/**
* Check if the current network connection is metered according to the Network Information API.
*/
export function getIsBrowserConnectionMetered() {
const connection = (navigator as NavigatorWithConnection).connection;
if (!connection) {
return false;
}

if (connection.saveData || connection.metered) {
return true;
}

const effectiveType = connection.effectiveType;
return effectiveType === '2g' || effectiveType === 'slow-2g';
}

/**
* Abstract base class for metered connection services.
*/
export abstract class AbstractMeteredConnectionService extends Disposable implements IMeteredConnectionService {
declare readonly _serviceBrand: undefined;

private readonly _onDidChangeIsConnectionMetered = this._register(new Emitter<boolean>());
public readonly onDidChangeIsConnectionMetered = this._onDidChangeIsConnectionMetered.event;

private _isConnectionMetered: boolean;
private _isBrowserConnectionMetered: boolean;
private _respectMeteredConnections: boolean;

constructor(configurationService: IConfigurationService, isBrowserConnectionMetered: boolean) {
super();

this._isBrowserConnectionMetered = isBrowserConnectionMetered;
this._respectMeteredConnections = configurationService.getValue<boolean>(METERED_CONNECTION_SETTING_KEY);
this._isConnectionMetered = this._respectMeteredConnections && this._isBrowserConnectionMetered;

this._register(configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(METERED_CONNECTION_SETTING_KEY)) {
const value = configurationService.getValue<boolean>(METERED_CONNECTION_SETTING_KEY);
if (value !== this._respectMeteredConnections) {
this._respectMeteredConnections = value;
this.onUpdated();
}
}
}));
}

public get isConnectionMetered(): boolean {
return this._isConnectionMetered;
}

protected get isBrowserConnectionMetered(): boolean {
return this._isBrowserConnectionMetered;
}

public setIsBrowserConnectionMetered(value: boolean) {
if (value !== this._isBrowserConnectionMetered) {
this._isBrowserConnectionMetered = value;
this.onChangeBrowserConnection();
}
}

protected onChangeBrowserConnection() {
this.onUpdated();
}

protected onUpdated() {
const value = this._respectMeteredConnections && this._isBrowserConnectionMetered;
if (value !== this._isConnectionMetered) {
this._isConnectionMetered = value;
this.onChangeIsConnectionMetered();
}
}

protected onChangeIsConnectionMetered() {
this._onDidChangeIsConnectionMetered.fire(this._isConnectionMetered);
}
}
Loading
Loading