Skip to content

Commit f224c59

Browse files
author
Jackson Kearl
authored
Dont show status bar mode picker if there's no declared mode support. Ref microsoft#89482. (microsoft#90183)
1 parent f1be499 commit f224c59

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/vs/workbench/browser/parts/editor/editorStatus.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,13 +575,14 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
575575
}
576576

577577
private updateStatusBar(): void {
578+
const activeInput = this.editorService.activeEditor;
578579
const activeControl = this.editorService.activeControl;
579580
const activeCodeEditor = activeControl ? withNullAsUndefined(getCodeEditor(activeControl.getControl())) : undefined;
580581

581582
// Update all states
582583
this.onScreenReaderModeChange(activeCodeEditor);
583584
this.onSelectionChange(activeCodeEditor);
584-
this.onModeChange(activeCodeEditor);
585+
this.onModeChange(activeCodeEditor, activeInput);
585586
this.onEOLChange(activeCodeEditor);
586587
this.onEncodingChange(activeControl, activeCodeEditor);
587588
this.onIndentationChange(activeCodeEditor);
@@ -609,7 +610,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
609610

610611
// Hook Listener for mode changes
611612
this.activeEditorListeners.add(activeCodeEditor.onDidChangeModelLanguage((event: IModelLanguageChangedEvent) => {
612-
this.onModeChange(activeCodeEditor);
613+
this.onModeChange(activeCodeEditor, activeInput);
613614
}));
614615

615616
// Hook Listener for content changes
@@ -663,11 +664,11 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
663664
}
664665
}
665666

666-
private onModeChange(editorWidget: ICodeEditor | undefined): void {
667+
private onModeChange(editorWidget: ICodeEditor | undefined, editorInput: IEditorInput | undefined): void {
667668
let info: StateDelta = { mode: undefined };
668669

669670
// We only support text based editors
670-
if (editorWidget) {
671+
if (editorWidget && editorInput && toEditorWithModeSupport(editorInput)) {
671672
const textModel = editorWidget.getModel();
672673
if (textModel) {
673674
const modeId = textModel.getLanguageIdentifier().language;

0 commit comments

Comments
 (0)