Implements data channels (#256226)

This commit is contained in:
Henning Dieterichs
2025-07-16 13:43:02 +02:00
committed by GitHub
parent 4ac51cd2bb
commit 67b27dba35
14 changed files with 302 additions and 4 deletions

View File

@@ -43,6 +43,7 @@ import { IExtHostCommands } from './extHostCommands.js';
import { createExtHostComments } from './extHostComments.js';
import { ExtHostConfigProvider, IExtHostConfiguration } from './extHostConfiguration.js';
import { ExtHostCustomEditors } from './extHostCustomEditors.js';
import { IExtHostDataChannels } from './extHostDataChannels.js';
import { IExtHostDebugService } from './extHostDebugService.js';
import { IExtHostDecorations } from './extHostDecorations.js';
import { ExtHostDiagnostics } from './extHostDiagnostics.js';
@@ -151,6 +152,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostAuthentication = accessor.get(IExtHostAuthentication);
const extHostLanguageModels = accessor.get(IExtHostLanguageModels);
const extHostMcp = accessor.get(IExtHostMpcService);
const extHostDataChannels = accessor.get(IExtHostDataChannels);
// register addressable instances
rpcProtocol.set(ExtHostContext.ExtHostFileSystemInfo, extHostFileSystemInfo);
@@ -169,6 +171,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
rpcProtocol.set(ExtHostContext.ExtHostProgress, extHostProgress);
rpcProtocol.set(ExtHostContext.ExtHostAuthentication, extHostAuthentication);
rpcProtocol.set(ExtHostContext.ExtHostChatProvider, extHostLanguageModels);
rpcProtocol.set(ExtHostContext.ExtHostDataChannels, extHostDataChannels);
// automatically create and register addressable instances
const extHostDecorations = rpcProtocol.set(ExtHostContext.ExtHostDecorations, accessor.get(IExtHostDecorations));
@@ -451,6 +454,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
get appCommit(): string | undefined {
checkProposedApiEnabled(extension, 'resolvers');
return initData.commit;
},
getDataChannel<T>(channelId: string): vscode.DataChannel<T> {
checkProposedApiEnabled(extension, 'dataChannels');
return extHostDataChannels.createDataChannel(extension, channelId);
}
};
if (!initData.environment.extensionTestsLocationURI) {