Skip to content

Add setting to show editor indexes in Open Editors view#313946

Open
duphyf wants to merge 1 commit intomicrosoft:mainfrom
duphyf:open-editors-show-tab-index
Open

Add setting to show editor indexes in Open Editors view#313946
duphyf wants to merge 1 commit intomicrosoft:mainfrom
duphyf:open-editors-show-tab-index

Conversation

@duphyf
Copy link
Copy Markdown

@duphyf duphyf commented May 3, 2026

Fixes #313945

Summary

This PR adds a new setting:

"explorer.openEditors.showTabIndex": true

When enabled, the Open Editors view shows the 1-based index of each editor within its editor group.

This mirrors the existing editor tab index behavior by using the existing namePrefix.

Verification

Manually verified:

  • Enabled and disabled explorer.openEditors.showTabIndex
  • Verified that Open Editors updates when the setting changes
  • Verified multiple editor groups
  • Verified hidden editor tabs with "workbench.editor.showTabs": "none"
  • Verified explorer.openEditors.sortOrder

Implementation notes

  • Reuses the existing namePrefix support
  • Refreshes the Open Editors list when explorer.openEditors.showTabIndex changes
  • Keeps the existing explorer.openEditors.sortOrder update logic separate from repaint-only configuration changes

Copilot AI review requested due to automatic review settings May 3, 2026 12:53
@duphyf
Copy link
Copy Markdown
Author

duphyf commented May 3, 2026

@duphyf please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new Explorer setting to show 1-based editor indexes in the Open Editors view, aligning that view more closely with the existing tab index behavior in the editor area.

Changes:

  • Registers a new explorer.openEditors.showTabIndex boolean setting under the Explorer configuration.
  • Updates OpenEditorsView to refresh when the new setting changes.
  • Prefixes Open Editors labels with each editor's 1-based index within its group when the setting is enabled.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/contrib/files/browser/views/openEditorsView.ts Refreshes the Open Editors list on configuration changes and adds the optional index prefix to rendered editor labels.
src/vs/workbench/contrib/files/browser/files.contribution.ts Declares the new explorer.openEditors.showTabIndex setting in the Explorer configuration schema.

Comment on lines +683 to 688
const showTabIndex = this.configurationService.getValue<boolean>('explorer.openEditors.showTabIndex');
const editorIndex = openedEditor.group.getIndexOfEditor(openedEditor.editor);
const namePrefix = showTabIndex
? `${editorIndex + 1}: `
: undefined;
templateData.root.setResource({
Comment on lines +443 to +446
'explorer.openEditors.showTabIndex': {
'type': 'boolean',
'description': nls.localize('openEditorsShowTabIndex', 'When enabled, will show the tab index.'),
'default': false,
@duphyf
Copy link
Copy Markdown
Author

duphyf commented May 3, 2026

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show editor indexes in the Open Editors view

4 participants