Skip to content

Conversation

@swordjjjkkk
Copy link
Contributor

I'd like a setting to decide show tab index.
there are two reasons i need to open this pull request.

1.It's useful for vim extension use <leader>+num to switch tab pages , and this won't disturb regular users, as it is disabled by default.
2.I tried compile an oss version , but the remote-ssh Extension not support oss version.

I look forward to any feedback or suggestions for improvement. Thank you for considering.

@swordjjjkkk
Copy link
Contributor Author

@microsoft-github-policy-service agree

Copy link

@moataz2002 moataz2002 left a comment

Choose a reason for hiding this comment

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

Nice to be merged

@dbaeumer dbaeumer requested review from benibenj and removed request for benibenj April 2, 2024 09:09
@dbaeumer dbaeumer assigned benibenj and unassigned dbaeumer Apr 2, 2024
@benibenj
Copy link
Contributor

benibenj commented Apr 4, 2024

Please create an issue for this feature and link this PR. Make sure to add a detailed description which describes the use case and the problem it solves.

FYI we added custom editor labels in this months release. It allows you change the name of the open editors/tabs. The setting name is workbench.editor.customLabels.patterns. But it won't give you any info on the tab index.

@swordjjjkkk
Copy link
Contributor Author

Please create an issue for this feature and link this PR. Make sure to add a detailed description which describes the use case and the problem it solves.

FYI we added custom editor labels in this months release. It allows you change the name of the open editors/tabs. The setting name is workbench.editor.customLabels.patterns. But it won't give you any info on the tab index.

fixes #209533

@bpasero
Copy link
Member

bpasero commented Apr 7, 2024

FYI we added custom editor labels in this months release. It allows you change the name of the open editors/tabs. The setting name is workbench.editor.customLabels.patterns. But it won't give you any info on the tab index.

I like the idea of having a new variable for the tab index for custom editor labels. Maybe one that is group-relative and one that is global?

@ghrejoe
Copy link

ghrejoe commented May 31, 2024

Please create an issue for this feature and link this PR. Make sure to add a detailed description which describes the use case and the problem it solves.

FYI we added custom editor labels in this months release. It allows you change the name of the open editors/tabs. The setting name is workbench.editor.customLabels.patterns. But it won't give you any info on the tab index.

It would be great if we could add it to this setting

@benibenj
Copy link
Contributor

I would disagree with making this part of the workbench.editor.customLabels.patterns setting. Custom Labels have no relation to tabs/editor groups state. I would rather add a new setting workbench.editor.showIndex or something like this. This would just prepend the index of the editor in the group to the tab. I also check if we could make it part of one of the label format settings but I don't think that would work. What do you think @ghrejoe @bpasero?

@microsoft microsoft deleted a comment from moataz2002 May 31, 2024
@microsoft microsoft deleted a comment from moataz2002 May 31, 2024
@microsoft microsoft deleted a comment from moataz2002 May 31, 2024
@microsoft microsoft deleted a comment from moataz2002 May 31, 2024
Copy link
Contributor

@benibenj benibenj left a comment

Choose a reason for hiding this comment

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

Just a quick review. Haven't tested yet. Also there is a merge conflict. But we still need to finish discussing if and how this should exactly work.

@ghrejoe
Copy link

ghrejoe commented May 31, 2024

I would disagree with making this part of the workbench.editor.customLabels.patterns setting. Custom Labels have no relation to tabs/editor groups state. I would rather add a new setting workbench.editor.showIndex or something like this. This would just prepend the index of the editor in the group to the tab. I also check if we could make it part of one of the label format settings but I don't think that would work. What do you think @ghrejoe @bpasero?

I agree with your statement. I used to think that I was worried about adding too many settings and causing redundancy. In fact, what I am more concerned about is being able to correctly switch to the corresponding editor when using the vim plugin through the [tab index] gt command. I hope to use this feature in the next release so that I don't have to look for plugins every once in a while to see if they can be implemented :)

@swordjjjkkk swordjjjkkk requested review from jrieken and mjbvz as code owners June 3, 2024 10:04
@swordjjjkkk swordjjjkkk force-pushed the tabindex branch 4 times, most recently from 84a50a5 to a3e0c91 Compare June 3, 2024 12:38
@swordjjjkkk
Copy link
Contributor Author

I have made the code modifications as required, specifically modifying the following:
1.Moved the settings into options.
2.Moved tab refresh to updateOptions.
3.Simplified the code using a ternary operator.
4.Renamed the setting from 'workbench.tabIndex.enabled' to 'workbench.editor.showTabIndex'.
5.Removed some irrelevant code.

bpasero
bpasero previously requested changes Jun 3, 2024
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

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

I am still not 100% sold that this cannot be configured through editor custom labels. We now limit this feature to how the index appears by hardcoding it (using just the number or number + dot) when people maybe want to configure this (see https://github.com/mkitt/tabline.vim where colon is used).

@bpasero bpasero removed request for jrieken and mjbvz June 3, 2024 12:51
@benibenj
Copy link
Contributor

benibenj commented Jul 11, 2024

@bpasero Custom Labels work solely based on the file path. It's possible that a custom label is rendered for a file which is not opened. In that case no index could be resolved.

Imagine the template ${tabIndex}: ${filename}.${extname}. If we render the custom label for a file which is not open for example in quick open ${tabIndex} could not be resolved to a number, hence we would have to render an empty string for it and so it would display : file.txt which is not wanted.

Also, if custom labels would use editor group information, it would probably strongly impact performance.

I wonder if we could still allow this to be customized without using custom labels. Any ideas?

@benibenj
Copy link
Contributor

benibenj commented Aug 20, 2024

@swordjjjkkk Untitled editors are not getting the index prepended:
image

@vivodi
Copy link

vivodi commented Dec 29, 2024

Is this still relevant?

@benibenj benibenj dismissed bpasero’s stale review August 6, 2025 14:53

We will add the tab index with a predefined format for the moment. If the index format needs to be configurable in the future we can consider that later.

benibenj
benibenj previously approved these changes Aug 6, 2025
@vs-code-engineering vs-code-engineering bot added this to the August 2025 milestone Aug 6, 2025
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

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

I will review later

bpasero
bpasero previously requested changes Aug 7, 2025
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

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

This is not in a good state, esp. around the last commit that adds knowledge about how to render untitled into the tabs control.

I would expose a new option prefix on the label that is passed down based on this setting.

@Tyriar Tyriar disabled auto-merge August 11, 2025 18:33
@Tyriar
Copy link
Member

Tyriar commented Aug 11, 2025

@benibenj I think this should get @bpasero's final approval considering the back and forth

@benibenj benibenj enabled auto-merge (squash) August 12, 2025 15:38
@benibenj benibenj disabled auto-merge August 12, 2025 15:38
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

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

The display of tab index cannot be localised, which I think is fair considering we want to define how the experience is, but just wanted to note that maybe not in all languages {number}: {name} is natural.

@bpasero bpasero enabled auto-merge (squash) August 14, 2025 08:30
@bpasero bpasero merged commit fca79ef into microsoft:main Aug 14, 2025
17 checks passed
@roachsinai
Copy link

Thanks a lot!

@ghrejoe
Copy link

ghrejoe commented Aug 19, 2025

I've already experienced this feature in the Code Insiders version, and I find it very useful.

@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Sep 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet