wmjordan / Codist

A visual studio extension which enhances syntax highlighting, quick info (tooltip), navigation bar, scrollbar, display quality, and brings smart tool bar with code refactoring to code editor.
https://marketplace.visualstudio.com/items?itemName=wmj.Codist
GNU General Public License v3.0
305 stars 27 forks source link

Future Feature Discussion: Tab Groups #80

Open fitdev opened 5 years ago

fitdev commented 5 years ago

When working with large projects with many files, it is sometimes useful to group various open tabs (files) into a separate window(s), so that each window contains related files you are currently working on.

There is an existing extension called Workspace Manager that has the ability to save all open tabs and windows, so that they can be restored later. While it is very useful, often it is an overkill (in that all the tabs and windows are saved and then restored). More often it would be nice to save just a tab "set" or "group", so that all the tabs (files) that comprise it can be opened later in either the new window, or appended to the tabs in existing window.

Ideally tabs should be selectable, so you can easily create a new tab group out of already opened tabs, and then be able to manage all those tabs as a single unit - be able to close them or restore them in the current or new window.

I think this functionality can hugely aid productivity in certain cases. For example, you are working on the main feature, but from time to time you need to make changes to a side feature or infrastructure / utility layer in your project. With this proposed feature you would be able to easily restore a tab group (containing the necessary files of that side feature), quickly make necessary changes, and then close the tab group, getting back to work on the main feature.

This is just one use case for tab groups. There are plenty of others.

wmjordan commented 5 years ago

Thank you for sharing your ideas. It seems that it is a unique feature that we can't find in the market place.

I'd love to have it too. I will pin this and invite users to comment on it.

fitdev commented 5 years ago

Glad you liked the idea!

wmjordan commented 5 years ago

Do you have any idea at which places on the interface should those tab groups be placed and accessed?

fitdev commented 5 years ago

Glad you started working on this feature! On large projects / solutions, this is definitely a must have, especially if you are working on several features / areas at once.

Perhaps, as a first iteration you can start with a toolbar with a dropdown, similar to how Workspace Manager does it. That would probably be simplest to implement.

A more advanced way would be similar to how it's done by Simple Tab Groups Firefox Extension. Every window with document tabs would have a small dropdown button in the corner with a list of active tab groups to which you can switch. However this requires the API (which I am not sure is present in the VS), whereby the document tab is hidden but not closed. While this approach viable for cases when there are many, many tabs open (50+) as it will allow for more space by hiding tabs), it will likely require a lot more coding.

Core Features

  1. Create new tab groups, delete existing tab groups (renaming would also be nice, but that's for later)
  2. Add tabs (documents) to existing tab groups by right-clicking on either the opened tab or file in Solution Explorer and selecting appropriate (new) menu item. Menu item itself can be either implemented as a submenu (from where tab group is to be chosen: TabGroup1, TabGroup2, New Tab Group...), or as a popup dialog with a list of tab groups.
  3. Remove tabs (documents) from tab groups - probably in a similar fashion to how you add them
  4. Ideally a particular file (document) can belong to more than one tab group, and items 2 and 3 should reflect that by displaying a checkmark (or allowing to place/remove checkmark) next to all the tab groups where a file belongs.
  5. For opening all files belonging to a tab group: Selecting a tab group from the dropdown, and then have a few choices: open all in new window, append to the tabs of existing Window, optionally pin the tabs. If the file is already opened in VS, then no action is performed for that file from a tab group when the tab group is being opened. If the file cannot be found or does not exist, then either remove it from the tab group definition (and log the error / show message (most likely just log the error so not to distract the user)) or keep it there but ignore it - perhaps have it as an option.
  6. Tab groups should probably be saved in the Solution root, i.e. be per-solution based (as opposed to being per-user). Most likely absolute file paths should be used in the tab groups file format, and it should be editable (i.e. text/xml/json) so that if there is a need it can be edited manually (new files added, paths changed).

Future Features:

Related Features:

wmjordan commented 5 years ago

Thanks for sharing detailed ideas. It is really helpful for developing the thing. I am currently working on providing context menu for symbols within the Quick Info, integrating the Symbol Analyzer commands into them. The tab groups feature is on my planned list, but not yet on the working-in-progress queue.

The firefox extension is a good example.

The place of the button for tab management is the first thing to be considered. It must be closed at hand, since I don't use keyboard too much when I am browsing the code, but also be keyboard friendly for some users prefer working with both hands.

The tab group button should be universally available if any document is opened. Placing it on to the navigation bar does not seem to be a good option since the bar does not exist in some document types. Placing it onto the ordinary toolbar may be an option.

fitdev commented 5 years ago

I agree, the tab group button should not be placed on the Nav Bar, since its' more universal. Ideally, if VS API allows it, it could be placed before or after the "V" more tabs button on the tab bar itself.

wmjordan commented 5 years ago

I am afraid no API allows that. Currently the Navi Bar is a result of WPF hacking, so to the scroll bars and overridden XML Doc in Super Quick Info. The Tab Group button may be that type of hacking as well.

fitdev commented 5 years ago

Oh wow! I did not know those things required WPF hackery to accomplish. Makes your work even more impressive, because from the UI point of view everything is really smooth! If you could "hack" the Tab Bar in a similar fashion by adding a button to it that would be great - since it seems to be the most logical place for a button to manage tab groups. But of course, priorities first - if it's easier to place it in a toolbar for now - then by all means you should not worry about getting the tab groups buttons on the Tab Bar - having that functionality is far more important than having it in the most desired place (Tab Bar vs Toolbar).

wmjordan commented 5 years ago

The hacking of Tab Bar will be more challenging, since it is possible to have multiple tab groups and consequently there will be two or more tab manager buttons. shot

fitdev commented 5 years ago

Oh I see. Well, perhaps consider it for the future, like V2, or V3 of the feature. I would be really great just to have the core functionality. So maybe start with a dedicated toolbar.

The only issue is how to tell the program where a particular tab group should be opened (tabs appended):

wmjordan commented 5 years ago

It seems that it is OK to have multiple Tab manager buttons, individually on each grouped windows, and the implementation may be easier than placing a single button on a tool bar.

Fortunately hacking into a WPF application is much easier than a Win32 one, a bit easier than a WinForm one when we have gotten on the track.

fitdev commented 5 years ago

That's great! It would certainly work better from the UI point of view.

Another thing to consider is how the selection of the tab groups should be presented. There can be potentially many (100+) tab groups in a solution. So a simple menu approach might not work very well and is not flexible. Perhaps you can repurpose your Component list control for that? It would also allow for tooltips to be shown as you move the mouse over various tab groups in the list, and those tooltips might list the constituent files 9documents) of the tab group.

wmjordan commented 5 years ago

Were there scores of tab groups, could it still help improving your productivity?

...... This thing includes so much work. I am not very sure whether I can hang on with it.

fitdev commented 5 years ago

Well, my intended use case was that if you have a large solution, on which you work over several years, you are slowly adding new features / updating existing features.

So, on one week you may be working on features A, B, C. On another week on features / areas D, E, F. Each feature / area involves dealing with several code files and so can be represented well by a tab group (really a group of files).

Having 100+ tab groups does not mean that all of them will be open at the same time. I simply meant that their definitions (items) will be included on the list, so you can just click on the item from the list, and it will load corresponding files / documents into the active window / tab bar. This is especially useful if you need to come back to a feature months later - you may not even remember what files you need to open to properly work on the feature / area. Hence you save those files as a tab group, when done, the will be closed by you, but then months later you will be able to reopen all of them in a single click because they are saved as a tab group.

Perhaps I clarified the use case somewhat.

wmjordan commented 5 years ago

Will this thing meet your requirements?

https://marketplace.visualstudio.com/items?itemName=SergeyVlasov.FavoriteDocuments

fitdev commented 5 years ago

I have looked at it, but it's very basic. The UI is a bit awkward. For example, I would like to just right-click on a tab or a file in solution explorer, and add it to / remove from existing group. There is no way to open documents into a specific window or tab bar either. No way to close documents that belong to a given tab group. So, it's ok as a very basic list of documents, but certainly nowhere near the tab groups I would like to have.

wmjordan commented 5 years ago

How about placing that tab group manager into a tool window?

fitdev commented 5 years ago

Sure, that seems fine. What were the other options?

Update While waiting for this feature from Codist or other extension, I have settled on the following workflow:

Have multiple VS document windows open on the 2nd monitor - each window with its own set of tabs (grouped by feature/area for my convenience). So basically each window acts as a tab group. Even this rudimentary setup is good if not for 2 missing features:

wmjordan commented 5 years ago
  • Ability to give those VS windows titles

This should not be too difficult, I guess. There have been extensions doing this out there.

  • Ability to quickly save all tabs opened in a given window, including the layout (in case of split views and/or pinned tabs)

"including layout" goes beyond my abilities. :(

fitdev commented 5 years ago

"including layout" goes beyond my abilities. :(

It's not that important. The most important things would be that all tabs within a window are saved (preferably with pin status too). Layout is a nice extra, in case you will be able to figure it out sometime.

wmjordan commented 5 years ago

Quite a lot of things to do. Maybe it can be implemented when version 6 is out.

fitdev commented 5 years ago

That would be great! As I suggested, perhaps a simpler approach could be using VS windows (this would probably work well in single monitor setup, but would be most useful in multiple monitor setup).

So, just give ability to assign Titles / otherwese make windows distinguishable form each other on Windows Taskbar. And ability to save / restore all tabs to / from existing / new window.

wmjordan commented 4 years ago

You may want to try this out: https://marketplace.visualstudio.com/items?itemName=Ant-f.WorkingFilesList

fitdev commented 4 years ago

Thank you for your suggestion! I have tried it in the past, but it did not seem to work for me. I will give it another go though.

wmjordan commented 4 years ago

I downloaded and worked quite a few days with the aforementioned WorkingFilesList extension.

I found myself seldom wanted to look at that list when many code files were opened. The most heavily used features in these days were still the Click&Go in the Super Quick Info, the Find References provided by the symbol analysis command, and sometimes the document tab.

I previously attempted to list five mostly referenced classes or members by the active method or property where the caret was in on the navigation bar, after you posted this issue. I also found that the automatic reference list helped little.

A list with (recently) opened documents does not seem to be the savior when working with complicated projects. The Click&Go and Reference analysis have done quite a good part of job in file navigation.

I still have some doubt about such kind of manually managed file groups could help much.

Throughout months, I found that in one day, I majorly worked with several code files on solving a problem or developing a feature, but very soon after the task was finished, the association among those several files dissolved. I didn't need to work with those files together any more. And the above workflow continued with another group of code files, for another task, on and on. If I considered those files should have a solid relationship, I usually wrote some XML documentation onto them (with seealso or see), thus I could jump between them when needed.

Ultimately, I would love to develop a way to detect the logic behind the "code files group" automatically without the need of the manipulation of a programmer--I am really a bit lazy to maintain such kind of groups. That's the reason why I have not put this into the development list after you posted this almost one year before even I felt the similar needs myself.

fitdev commented 4 years ago

Thank you for sharing your thoughts and experience. A lot of what you say does apply to me as well.

However, in my case (perhaps a somewhat rarer use case) I often need to work very slowly on certain areas / features for months at a time (a few hours on one week, a few hours on another week) - slowly developing those features. So that in a week I could be working on 10 different areas potentially from different projects quite easily.

That almost always involves working with a group of same files/tabs over and over again, which can often reside not just in different folders, but different projects altogether. The later point is important in that multiple scoped and named Solution Explorers by itself is not enough to easily give access to the needed files, and tab groups are really valuable in this regard, since they can have files from entirely different directories grouped nicely together for a specific context. Of course, those same files can be grouped differently in a different tab group with other files for a different context.

This scenario for me is probably best addressed by named, most likely solution-specific tab groups that you can load to / append to an existing / new window.

There are some details of course that need to be decided... Like what to do if the file in a group is already loaded in another tab (probably leave it there by default), or what to do if the file no longer exists (probably do nothing, maybe output a warning in VS log or something).

In this regard Workspace Manager for example is a good start, but unfortunately it completely replaces all the tabs in all windows, which is not desirable.

wmjordan commented 3 years ago

Well, today I have a solution with 21 projects and about 1,000 C# code files altogether. I will try to see how to improve the working experience...

Shall we model the relationships between documents as graphs?

fitdev commented 3 years ago

That's getting closer to my solution: 50+ projects and a few 1000 files or so :) Glad to know that now you work in a similar environment where you can experiment with!

As a side note: I am not aware of any existing extension or VS feature that lets you easily navigate between projects in the Solution Explorer. As a result, when many projects are expanded with many folders and files in them, it can take quite a while for me to scroll up/down to the other project that I need. So perhaps Solution Explorer can be extended with like a dropdown list / menu of projects?

Presently I use Workspace Manager 1.2.0 extension to save/load open code windows and tabs configurations. It works ok, but I think the experience can be improved. I would rather prefer to have a more granular control: like open a predefined set of files in the current/new window for example.

Shall we model the relationships between documents as graphs? Not sure exactly what you mean. But I think that relationships are basically graphs, so this sounds good to me.

fitdev commented 3 years ago

Sorry, wrong formatting in the post above (cannot edit it for some reason). I meant:

Shall we model the relationships between documents as graphs?

Not sure exactly what you mean. But I think that relationships are basically graphs, so this sounds good to me.

wmjordan commented 3 years ago

Thank you for your reply and information.

The "graphs" meant the data structure. Objects in code files reference each other. A.cs file may reference objects in B.cs and C.cs. B.cs may reference objects A.cs and D.cs. C.cs reference objects in A.cs and D.cs etc.

fitdev commented 3 years ago

Oh I see what you mean. Sure, it makes perfect sense to use graphs then!

wmjordan commented 2 years ago

Recently I found a thing called MentalSnapshot: https://contextkeeper.io Would you care register a private beta there and see whether it meets your requirement?

fitdev commented 2 years ago

Thank you very much for letting me know about this. Yes. this is the sort of thing I was looking for. My only concern is that it would require Internet connection and/or account, and I do not like such things. For now I am using Workspace Manager, which has recently been updated to work with VS 2022 and is OK. It would be great if it had ability to support multiple named and scoped Solution Explorer instances. These are the only 2 features I need really: opened documents and windows + their layout, and multiple solution explorer views that can be persisted from session to session.

fitdev commented 2 years ago

And somewhat related, perhaps it should be another feature request / issue. I wish there was a way to quickly jump to a given project is Solution Explorer. I have 70+ projects many of them in extended state (multiple levels), and so I end up scrolling quite often to locate the needed folder in the needed project.