@@ -26,12 +26,12 @@ import { AnnotatedDocuments } from '../helpers/annotatedDocuments.js';
2626import { DataChannelForwardingTelemetryService } from './forwardingTelemetryService.js' ;
2727import { EDIT_TELEMETRY_DETAILS_SETTING_ID , EDIT_TELEMETRY_SHOW_DECORATIONS , EDIT_TELEMETRY_SHOW_STATUS_BAR } from '../settings.js' ;
2828import { VSCodeWorkspace } from '../helpers/vscodeObservableWorkspace.js' ;
29+ import { IExtensionService } from '../../../../services/extensions/common/extensions.js' ;
2930
3031export class EditTrackingFeature extends Disposable {
3132
3233 private readonly _editSourceTrackingShowDecorations ;
3334 private readonly _editSourceTrackingShowStatusBar ;
34- private readonly _editSourceDetailsEnabled ;
3535 private readonly _showStateInMarkdownDoc = 'editTelemetry.showDebugDetails' ;
3636 private readonly _toggleDecorations = 'editTelemetry.toggleDebugDecorations' ;
3737
@@ -43,19 +43,32 @@ export class EditTrackingFeature extends Disposable {
4343 @IStatusbarService private readonly _statusbarService : IStatusbarService ,
4444
4545 @IEditorService private readonly _editorService : IEditorService ,
46+ @IExtensionService private readonly _extensionService : IExtensionService ,
4647 ) {
4748 super ( ) ;
4849
4950 this . _editSourceTrackingShowDecorations = makeSettable ( observableConfigValue ( EDIT_TELEMETRY_SHOW_DECORATIONS , false , this . _configurationService ) ) ;
5051 this . _editSourceTrackingShowStatusBar = observableConfigValue ( EDIT_TELEMETRY_SHOW_STATUS_BAR , false , this . _configurationService ) ;
51- this . _editSourceDetailsEnabled = observableConfigValue ( EDIT_TELEMETRY_DETAILS_SETTING_ID , false , this . _configurationService ) ;
52+ const editSourceDetailsEnabled = observableConfigValue ( EDIT_TELEMETRY_DETAILS_SETTING_ID , false , this . _configurationService ) ;
53+
54+ const extensions = observableFromEvent ( this . _extensionService . onDidChangeExtensions , ( ) => {
55+ return this . _extensionService . extensions ;
56+ } ) ;
57+ const extensionIds = derived ( reader => new Set ( extensions . read ( reader ) . map ( e => e . id ?. toLowerCase ( ) ) ) ) ;
58+ function getExtensionInfoObs ( extensionId : string , extensionService : IExtensionService ) {
59+ const extIdLowerCase = extensionId . toLowerCase ( ) ;
60+ return derived ( reader => extensionIds . read ( reader ) . has ( extIdLowerCase ) ) ;
61+ }
5262
63+ const copilotInstalled = getExtensionInfoObs ( 'GitHub.copilot' , this . _extensionService ) ;
64+ const copilotChatInstalled = getExtensionInfoObs ( 'GitHub.copilot-chat' , this . _extensionService ) ;
5365
66+ const shouldSendDetails = derived ( reader => editSourceDetailsEnabled . read ( reader ) || ! ! copilotInstalled . read ( reader ) || ! ! copilotChatInstalled . read ( reader ) ) ;
5467
5568 const instantiationServiceWithInterceptedTelemetry = this . _instantiationService . createChild ( new ServiceCollection (
5669 [ ITelemetryService , this . _instantiationService . createInstance ( DataChannelForwardingTelemetryService ) ]
5770 ) ) ;
58- const impl = this . _register ( instantiationServiceWithInterceptedTelemetry . createInstance ( EditSourceTrackingImpl , this . _editSourceDetailsEnabled , this . _annotatedDocuments ) ) ;
71+ const impl = this . _register ( instantiationServiceWithInterceptedTelemetry . createInstance ( EditSourceTrackingImpl , shouldSendDetails , this . _annotatedDocuments ) ) ;
5972
6073 this . _register ( autorun ( ( reader ) => {
6174 if ( ! this . _editSourceTrackingShowDecorations . read ( reader ) ) {
0 commit comments