mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-18 15:55:59 +01:00
Metered network connections support (#288919)
Includes public API, user setting, status bar icon and a new service to support metered network connections. Updates code in various areas performing automated actions using network to delay/pause network operations while network connection is being metered.
This commit is contained in:
@@ -118,6 +118,7 @@ import { IExtHostWindow } from './extHostWindow.js';
|
||||
import { IExtHostPower } from './extHostPower.js';
|
||||
import { IExtHostWorkspace } from './extHostWorkspace.js';
|
||||
import { ExtHostChatContext } from './extHostChatContext.js';
|
||||
import { IExtHostMeteredConnection } from './extHostMeteredConnection.js';
|
||||
|
||||
export interface IExtensionRegistries {
|
||||
mine: ExtensionDescriptionRegistry;
|
||||
@@ -160,6 +161,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
const extHostLanguageModels = accessor.get(IExtHostLanguageModels);
|
||||
const extHostMcp = accessor.get(IExtHostMpcService);
|
||||
const extHostDataChannels = accessor.get(IExtHostDataChannels);
|
||||
const extHostMeteredConnection = accessor.get(IExtHostMeteredConnection);
|
||||
|
||||
// register addressable instances
|
||||
rpcProtocol.set(ExtHostContext.ExtHostFileSystemInfo, extHostFileSystemInfo);
|
||||
@@ -181,6 +183,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
rpcProtocol.set(ExtHostContext.ExtHostAuthentication, extHostAuthentication);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostChatProvider, extHostLanguageModels);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostDataChannels, extHostDataChannels);
|
||||
rpcProtocol.set(ExtHostContext.ExtHostMeteredConnection, extHostMeteredConnection);
|
||||
|
||||
// automatically create and register addressable instances
|
||||
const extHostDecorations = rpcProtocol.set(ExtHostContext.ExtHostDecorations, accessor.get(IExtHostDecorations));
|
||||
@@ -428,6 +431,14 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
|
||||
checkProposedApiEnabled(extension, 'telemetry');
|
||||
return _asExtensionEvent(extHostTelemetry.onDidChangeTelemetryConfiguration);
|
||||
},
|
||||
get isMeteredConnection(): boolean {
|
||||
checkProposedApiEnabled(extension, 'envIsConnectionMetered');
|
||||
return extHostMeteredConnection.isConnectionMetered;
|
||||
},
|
||||
get onDidChangeMeteredConnection(): vscode.Event<boolean> {
|
||||
checkProposedApiEnabled(extension, 'envIsConnectionMetered');
|
||||
return _asExtensionEvent(extHostMeteredConnection.onDidChangeIsConnectionMetered);
|
||||
},
|
||||
get isNewAppInstall() {
|
||||
return isNewAppInstall(initData.telemetryInfo.firstSessionDate);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user