I don’t know how to formulate the question well or where to look for an answer, but here we go.
Is there currently a way (in Visual Studio IDE) to visually scope to specific code blocks (i.e. methods, class etc.) that are being worked. And pin them down while excluding sibling functions that are not relevant to the issue.
The Issue: Our code base is not too big, and everything is structured well(ish).
But when I dig deep into an issue/ feature I often find myself needing only to focus on few limited areas, like few code blocks, while these code blocks are spread around in different files (that all of them have more code in them), but sometimes also in same file just few hundreds/thousand lines apart. I find it mentally cumbersome to switch between theses areas (code blocks) quickly. The noise from the surrounding code and the fact the entire window navigates away from currently investigated method signature to the nested method i’m "going to" aka F12.
The things that i have tried are:
- "Peek Definition" while this is close to what i’m needing, the peek window shows on top the current code, making it just a longer scroll. Feels like a temporary window to you code!! If you expand peek view it’s navigate to the Entire file, while that can be useful, it’s also a bit much extra information
- Bookmarks are also great and the closest thing to what i need, I use them frequently as a way to jump to areas that i have marked as area of interest.
- "Search/find within current block" when I search for something or equally the absent of something, I find that searching in the scope of the method block, prevents the window from navigating away form the area i’m working on.
- pin down tabs and close other tabs (for time being!). This helps a little to put the focus on those main files.
- Split window. Vertically split screen is very intuitive and easy in VS, but gives a very limited view height
Horizontal split screen does not feel intuitive in VS, this i always struggle with this, especially on splitting the same file. - new instance of VS, as last resort i sometimes open a new instance of VS, so it’s easier to navigate same code base with two or more monitors.
Are there other options/tricks that I should try?
In my mind I wish that I could combine many of those above! Peek to nested function signature and only open that code block and create it as bookmark-ish item for easy navigating back to, search in the default scope across bookmarked code blocks, and split screen was as easy as in VS Code, while hiding everything else as an toggle option. But I don’t know if that’s feasible!?
2
Answers
Based on what you describe you can drag a window "out of VS" to a second monitor. Might work for you.
So just click down on the tab of a code file that you want to keep in view and drag it out of the main VS window.
My Task Canvas extension lets you work with multiple code fragments simultaneously.