@@ -37,6 +37,7 @@ import { ITelemetryService } from '../../../../platform/telemetry/common/telemet
37
37
import { IChatStatusItemService , ChatStatusEntry } from './chatStatusItemService.js' ;
38
38
import { ITextResourceConfigurationService } from '../../../../editor/common/services/textResourceConfiguration.js' ;
39
39
import { EditorResourceAccessor , SideBySideEditor } from '../../../common/editor.js' ;
40
+ import { getCodeEditor } from '../../../../editor/browser/editorBrowser.js' ;
40
41
41
42
const gaugeBackground = registerColor ( 'gauge.background' , {
42
43
dark : inputValidationInfoBorder ,
@@ -103,6 +104,8 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
103
104
104
105
private dashboard = new Lazy < ChatStatusDashboard > ( ( ) => this . instantiationService . createInstance ( ChatStatusDashboard ) ) ;
105
106
107
+ private readonly activeCodeEditorListener = this . _register ( new MutableDisposable ( ) ) ;
108
+
106
109
constructor (
107
110
@IChatEntitlementService private readonly chatEntitlementService : ChatEntitlementService ,
108
111
@IInstantiationService private readonly instantiationService : IInstantiationService ,
@@ -136,14 +139,30 @@ export class ChatStatusBarEntry extends Disposable implements IWorkbenchContribu
136
139
this . _register ( this . chatEntitlementService . onDidChangeQuotaExceeded ( ( ) => this . entry ?. update ( this . getEntryProps ( ) ) ) ) ;
137
140
this . _register ( this . chatEntitlementService . onDidChangeSentiment ( ( ) => this . entry ?. update ( this . getEntryProps ( ) ) ) ) ;
138
141
this . _register ( this . chatEntitlementService . onDidChangeEntitlement ( ( ) => this . entry ?. update ( this . getEntryProps ( ) ) ) ) ;
139
- this . _register ( this . editorService . onDidActiveEditorChange ( ( ) => this . entry ?. update ( this . getEntryProps ( ) ) ) ) ;
142
+
143
+ this . _register ( this . editorService . onDidActiveEditorChange ( ( ) => this . onDidActiveEditorChange ( ) ) ) ;
144
+
140
145
this . _register ( this . configurationService . onDidChangeConfiguration ( e => {
141
146
if ( e . affectsConfiguration ( defaultChat . completionsEnablementSetting ) ) {
142
147
this . entry ?. update ( this . getEntryProps ( ) ) ;
143
148
}
144
149
} ) ) ;
145
150
}
146
151
152
+ private onDidActiveEditorChange ( ) : void {
153
+ this . entry ?. update ( this . getEntryProps ( ) ) ;
154
+
155
+ this . activeCodeEditorListener . clear ( ) ;
156
+
157
+ // Listen to language changes in the active code editor
158
+ const activeCodeEditor = getCodeEditor ( this . editorService . activeTextEditorControl ) ;
159
+ if ( activeCodeEditor ) {
160
+ this . activeCodeEditorListener . value = activeCodeEditor . onDidChangeModelLanguage ( ( ) => {
161
+ this . entry ?. update ( this . getEntryProps ( ) ) ;
162
+ } ) ;
163
+ }
164
+ }
165
+
147
166
private getEntryProps ( ) : IStatusbarEntry {
148
167
let text = '$(copilot)' ;
149
168
let ariaLabel = localize ( 'chatStatus' , "Copilot Status" ) ;
0 commit comments