Developing for ASP.Net MVC, Visual Studio tab names are meaningless - c#

For all Visual Studio ASP.Net MVC developers - I'm sure you've faced this problem before:
In each one of my controllers, there is usually an Index, Create, Edit and Detail views. All of the default view files generated by ASP.Net's scaffolding are all given the same name, for example: index.cshtml. Granted, they're in different folders.
So it's really easy to get lost in Visual Studio when you have four or five tabs open, all with the same name! Is there a way/plugin to get visual studio show me something more meaningful, such as the controller name/view folder? Or do you developers just rename all of your files once they're generated? I already have resharper so bonus points if it's possible with that.

FYI If you just hover over the tab, it tells you what View/Folder it is in. That's one way to differentiate between the different tabs.

I use this plugin https://visualstudiogallery.msdn.microsoft.com/2e8ebfe4-023f-4c4d-9b7a-d05bbc5cb239 with VS2013 and VS Community 2015.

What I usually do so far is Ctrl+N with resharper:

The Productivity Power Tools extension has a custom document well that lets you color code the tabs. It is usually used to color code them by the project they are in, but it also allows you to use custom regex. You could disable the project based color coding and add custom regexes to color any document tab with "Edit" in the path Blue, and documents with "Create" Green, etc... You will need to turn on the option for "Use full document path for regular expression matching" under the "advanced" tab of the power tool options.

The VS add-in Tabs Studio works for me.
After installing open the Tab Studio add-in manager and select the Disambiguator add-in, i.e.:
Will then give you tabs like this:
Note: it costs $49 after the 30 day trial...

Related

Visual Studio 2015 quick action helpers have disappeared

Until very recently, my copy of Visual Studio 2015 Professional provided a very useful set of features, in particular...
changing the name of a property/method would give a light-bulb icon and the ability to update all instances of those properties/methods
using an unreferenced class/namespace would give a light-bulb icon and the ability to quickly add a using/Imports, along with multiple other options
Here is an example of the 2nd of the above... the light-bulb used to appear just to the left of the popup message.
I cannot find any obvious option that would turn this off.
The issue is happening in both C# and VB.Net projects
I recently had an issue with CodeLens, the solution I found told me to remove the %TEMP%\ALM directory. This fixed the CodeLens, but I'm wondering if it could have effected the light-bulb helpers.
Does anybody know how to get the light-bulb helpers to return?
After updating to VS2015 Update 3 the light-bulb helpers have returned

Show current method/block/region in Visual Studio plugin

I'm sure I used to be able to see the name of the current class and method when editing vb.net files - I can't see anything similar in VS 2015 Update 3.
Does anyone know if there's a plugin that would show me this info? Being able to see the name of the current region would be brilliant, too.
Thanks.
You don't need a plug-in; this feature is built into Visual Studio and has been since at least VS 2005. (Actually, it originated in the classic Visual Basic editor and was ported over to Visual Studio when the IDEs were integrated.) I'm not sure how it got disabled on your machine, since it is enabled by default.
Go to Tools → Options → Text Editor → Basic (or any language you want), and ensure that the "Navigation bar" option at the bottom is checked.
This will give you a bar at the top of your text editor window that displays the class and method names. It doesn't, however, display the region.
You can see the current region in "Visual Assist" extension.
You should download it from Nuget.(Tools --> Extension And Updates and then search the Visual Assist).
After you'll install it, You'll see a new tab called: "VA Outline" it's located near the Solution Explorer tab.

Hide code editor overlays in Visual Studio 2015 [duplicate]

Visual Studio 2013 introduced a new feature where it shows you how many times each of your methods are used.
I don't find it very useful, and it messes up the spacing of my file. How do I disable it? Can't seem to find the option.
I guess you probably are running the preview of VS2013 Ultimate, because it is not present in my professional preview. But looking online I found that the feature is called Code Information Indicators or CodeLens, and can be located under
Tools → Options → Text Editor → All Languages → CodeLens
(for RC/final version)
or
Tools → Options → Text Editor → All Languages → Code Information Indicators
(for preview version)
That was according to this link. It seems to be pretty well hidden.
In Visual Studio 2013 RTM, you can also get to the CodeLens options by right clicking the indicators themselves in the editor:
documented in the Q&A section of the msdn CodeLens documentation
Another option is to use mouse, right click on "x reference". Context menu "CodeLens Options" will appear, saving all the navigation headache.
Workaround....
In VS 2015 Professional (and probably other versions).
Go to Tools / Options / Environment / Fonts and Colours.
In the "Show Settings For" drop-down, select "CodeLens"
Choose the smallest font you can find e.g. Calibri 6.
Change the foreground colour to your editor foreground colour (say "White")
Click OK.
The other features of CodeLens like: Show Bugs, Show Test Status, etc (other than Show Reference) might be useful.
However, if the only way to disable Show References is to disable CodeLens altogether.
Then, I guess I could do just that.
Furthermore, I would do like I always have, 'right-click on a member and choose Find all References or Ctrl+K, R'
If I wanted to know what references the member -- I too like not having any extra information crammed into my code, like extra white-space.
In short, uncheck Codelens...
In VSCode for Mac (0.10.6) I opened "Preferences -> User Settings" and placed the following code in the settings.json file
"editor.referenceInfos": false
User and Workspace Settings

Visual Studio "document outline" for C# file

In Visual Studio (2013/2015/2017), the Document Outline window for C# files is always empty ("There are no items to show for the selected document.").
It seems that this functionality is not (not yet / no more) implemented.
But then, how do I view the structure of the file? Is there any extension which implements this functionality?
showing only the selected/opened file
show regions
move/rename members
show documentation
Using the Solution Explorer and Class View are NOT the solution.
In the old Visual Studio 2003, I did use a self written Add-In, because it was easy to read the structure. (There were also other tools but I cannot find them anymore). So I ask here which solution you know. :-)
EDIT: Similar question also found:
How to show code outline in Visual Studio?
UPDATE: After 10 years the feature has finally arrived in VS 2022
This feature has been added in Visual Studio 2022 17.4.0:
You can now easily view a file’s structure at a glance in the Document Outline window. The Document Outline window displays the symbol tree of the file in the editor helping you quickly navigate and edit project files. You can open Document Outline by going to View > Other Windows > Document Outline or by using the shortcut Ctrl+Alt+T.
Update: This feature was disabled in v17.4.4 for the following reason:
After we released 17.4, we found some significant performance problems with the C# implementation of Document Outline that we didn’t catch during preview usage. We’ve temporarily disabled the feature, and are spending more time working on it to address these issues. These changes are larger than we’d usually like to include in a revision release, and need more bake time, so 17.4.3 [sic] onwards & 17.5 will both ship with the feature disabled. I know this is disappointing, but we have it back in no time and enabled in a future VS update.
There is also CodeMaid which provides the same functionality as JetBrains Resharper, but is free.
The best solution I found at present is:
JetBrains ReSharper (v8.0+) has a File Structure window which shows the structure of the current file as tree (types/members) and regions are also supported.
If you don´t have ReSharper, you can´t miss the Productivity Power Tools, made by Microsoft itself.
There's a specific version for each of Visual Studio versions. More info on these links:
VS2013
VS2012
VS2010
They have a feature called Solution Navigator
Also, there's this one that seems very interesting for bring alot of cool customizations to Visual Studio IDE, called VSCommands. It's worth to checkout their website => http://vscommands.squaredinfinity.com/features
It helps you look at the nested structure of certain types of files, e.g. windows forms designer file, open a form designer you should see all controls on the form shown in nested structure in the document outline window.

Enable design mode of an sln project in SharpDevelop

I've been given a folder with many .cs files and a .sln to work on with the express interest of designing a GUI for the entire project. The only problem is, I don't know how.
I have both Visual Studio 2010 and SharpDevelop 4.4 at my disposal; though I'd like to learn both evenly if possible, because I like open-source IDEs, but value experience in Visual Studio as well.
I can't find any information on how to enable design mode in this situation because of how narrow my experience is with the tools; You see, I know to right-click on a .cs file in order to view its code or design in Visual Studio 2010... but that isn't available here. The only item I can see is "view code", which is not what I'm trying to do.
If I can't enable the form, I'm wondering if I can just... create a new one? Since one does not exist?
Thank you for your help.
EDIT: A screenshot of what I see (blurred for security)
Abstract answer
The designer only makes sense for some types of files. For example, Windows Forms designer exists for classes that inherit System.Windows.Forms.Control, and when the relevant attributes for that file are set in the project.
Practical answer
Make sure you have a project that allows Forms (like "Windows Forms Application" or "Windows Forms Control Library"), create one if needed.
In project tree, right-click on the project and use some "add new ..." in the context menu.
There, choose "Form" or "Control" depending on your intent. It should create and configure what's needed, and you'll be able to use the designer.
In Visual Studio you can switch between text and designer with a shortcut key (F7, Shift-F7) or context menu. In sharpdevelop use the "Source" and "Design" tabs.
In SharpDevelop if there is a designer available for the file then you can open the designer by:
Open the file into the text editor.
Click the Design tab at the bottom of the text editor.

Categories

Resources