-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide API to access and change editor tab labels #41909
Comments
@chengjianhua can you give more details about what you would want to change on the tabs from your extension? |
@bpasero I want to there is an api that I can leverage it to get the file paths of all active editors, and then use the file paths to generate the custom labels for active editors. According to the // Controls the format of the label for an editor. Changing this setting can for example make it easier to understand the location of a file:
// - short: 'parent'
// - medium: 'workspace/src/parent'
// - long: '/home/user/workspace/src/parent'
// - default: '.../parent', when another tab shares the same title, or the relative workspace path if tabs are disabled
"workbench.editor.labelFormat": "default", |
@usernamehw the If you think that my this requirement could be covered by adding an option in If I want change the slash |
This came up for Dart too: Dart-Code/Dart-Code#577 When a user F12's into a file that's in an external library, the filename is often fairly vague. It'd be nice if we could insert the packages name into the tab title text so it's more obvious to the user the package that they're in code for. |
I just ran into the same exact issue with as the parent poster. I was having the same usability problem with duplicated index.js files, and went looking for a solution. Finding no VSC extensions that would help in the marketplace I dug into the documentation along the exact same lines as chengjianhua. I too was disappointed to find that it was not possible to update the content of the editor tabs in any way from the extension API. I also have the same issue to a lesser extent in rust when dealing with mod.rs files. The current functionality provided by VSC of showing the folder in a de-emphasized label is helpful, but not as helpful as it could be, as I actually care more about the folder name than the file name in these cases. What I'd like to be able to modify through an extension is:
|
Found this open issue after extensive searching (lots of closed issues about this already), and it looks like a good option for allowing being able to control the tab titles and labels. The current behavior (even after all merged pull requests trying to fix the problem) is a big problem in Node projects, where Alternately, if an open, extensible API is too much to consider now, I would suggest re-considering #30316 (related to #27328), which also provides a solution to the |
Opening this up would also allow for things like @comerc's #12965 (comment) or @aazarkhish's issue #21662. |
In Dart it's common go import a file like |
I hope this feature gets added. It is not uncommon for a ReactJS project to have 20+ |
@bpasero The nice-index author switched to VSCode also, & is awaiting the API ;) |
That's great news. I hope they implement it soon. |
I am definitely waiting on this to be real. It would be tremendously useful. |
Any news? |
@bpasero Hi ~ Is there any new chances to plan this? |
Just started working on a new codebase with only index.js files... This would be amazingly nice to have! |
anyone working with the Component Folder Pattern in React (which is a lot of people) will really appreciate this. |
Just stumbled across this issue. Exactly what I've been looking for. I'm dealing with heaps of React components all named |
Same issue for me, the best could be able to change the color and the label of a tab on right click. |
@wesbos Glob patterns do not support capture groups so this is currently not possible, however, it should be pretty easy to just add multiple patterns to cover the different cases. You can accomplish your dynamic routes problem with two different entries. Regarding API: #41909 (comment) Something we are considering is for extensions to provide common patterns for the |
Great thank you - both of those answers seem more well thought out than my suggestion - thanks a ton! |
Can you clarify what this means? E.g. would VS Code ship with default patterns for SvelteKit, Next.js, etc.? When you say it would be easier for extensions to support, how would extensions be involved? |
@benmccann Extensions like the Next.js and SvelteKit extension would provide a set of values for this setting that would be applied when the extensions are installed |
Is it possible to somehow have parts of the names be upper/lower cased? e.g: I have an Index.vue file in a folder called "products". Then the custom label would be products.vue. I would like to have it Products.vue instead. |
I want to use this in an nx monorepo so that every filename is prefixed by the name of the app, e.g. |
@chromey the current implementation does not support this. What you can do for the meantime is to an entry for each app. I can see it would make sense to better support such cases. What we could do is add support for negative indices which would allow accessing the folder names from the start of the path. Would this be helpful for you? |
Thanks @benibenj, this would be helpful indeed. But the workaround you suggest is also an option for my case, given that there are only ~15 apps in the repo. Thanks again. |
Would it also be possible to support new lines? I'd love to be able to do something like #41909 (comment) |
@benmccann Please create a feature request for this |
Thank you. Done here: #209701 |
Hey thanks for the effort on this issue. It's great to see it getting added in this latest release. I'm wondering now if there will ever be any effort/ability to work with the hint label of a tab (as in the grayed out and italicized folder name next to the label)? As far as I can tell, the only options to modify the hint of tab label is Ideally, we could have complete control like we have with the main label through something like Duplicate labels inside of two different folders with very long names taking up the entire space of my tab bar. |
@riungemaina that's a bug which was introduced in yesterdays insiders. Tracking in #211522 |
@benibenj Can we support this in the "search by file", and the global search? |
@aminpaks Please open a new issue for this. |
Is this no longer working in the latest VSCode insiders? None of the old patterns are drawing for me and even using full paths won't work. tabLabelsBroken.mp4 |
Would be great if we were able to set custom titles not only for the file names but also the labels/hints ( |
@Luke-Callaghan23 Relative patterns now have to include the workspace folder name itself. This means you should change your patterns to one of the following:
Regarding absolute patterns, they must start with a |
If you have duplicate filenames in your workspace and want labels (showing folder name) automatically appear, you can support #209765 |
|
@benibenj @lramos15 Another use case: providing a meaningful label for custom editors. In my extension I am generating CPU/memory usage profiles and storing them in the extension's storage directory (or the OS temp directory, depending) and using a custom editor to present those to the user. As such, the default label is meaningless to the user. If I were able to set the title of the custom editor, I could make that something meaningful to the user. Unfortunately setting the |
Feature Request
The Atom has the ability to customize the tabs, it's so powerful for some requirements. For example, there is an extension nice-index in Atom that could be able to rename tabs of many opened editors have same name
index.js
, rename them to the names of their parent folder.It's very useful that if we could do so.
@bpasero I got it that the feature requested by #32836 will not be considered in the first half year of 2018. I think my feature request is very similar with that, so may I ask you when the ability to customize tabs in VSC would be added into the roadmap ?
I was excited when I start to think how can I implement a extension like
nice-index
in VSC, but after I involved in the documents about customizing a VSC extension, I just found that I can not achieve this. I hope that you could consider this feature request, thanks for all of your great works ~ 🙏The text was updated successfully, but these errors were encountered: