Visual Studio Customize What gets Outlined - c#

I just upgraded to VS2017, and I'm having issues with the Code Outlining. Specifically, I want methods, regions, classes to stay outlined and collapse/expand as they did in VS2015, but I don't want if/for and other code blocks to be outlined. I want them to always be expanded.
Anybody know how to do this?
Thanks

Turns out I found it myself in the settings.
In the Menu bar, Go to Tools->Options, then follow the trail in the image below to get the fix.
VS Settings
(I don't have enough reputation to post the image, so the link goes to it. If you don't want to go there, it's Tools->Options, then Text Editor->C#->Advanced and uncheck "Show outlining for code level constructs")

Related

How to delete “empty code templates” in Visual Studio 2019

My professor took off points on an assignment for “leaving Empty Code Templates throughout my submission”. I’ve included a picture of what he was referring to. If anyone could help explain how to remove these?
I tried deleting them, hoping it would be all fine but I just get an error when I go back to my form.
As mentioned by Blue in a comment
Click on the associated controls in the designer view, and click the lightning bolt to view events. Delete them from there and you should be free to delete the leftover code.
It is a bad idea to edit event code signatures outside the designer.
Make sure you open the designer often or have frequent version control to avoid file corruption.
a friend just fixed it for me, she said: “ just delete what you want to delete and when u go back to ur program and it has that error click on “go to code” on the top right corner and delete the part that’s underlined in red”

AvalonDock: Auto-hide tool cannot be shown once hidden

I'm using Dirkster99/AvalonDock 4.70.0
I have an MVVM architecture that's very similar in structure to the VS2013 sample application.
When I use a layout initialiser to make one of my tools auto-hide (just as the sample does), everything displays and functions correctly until I forcibly hide the tool (either by clicking on the X at top right, or by using the menu that is bound to the IsVisible property). Then, I find I can't make the tool visible again (by means of the menu).
I cannot work out what I'm doing that is different from the sample, which works perfectly in this regard.
If I disable the layout initializer and place the tool with others (so it does not auto-hide), it hides and shows correctly. If I float the tool before the hide, then it shows again correctly.
Can anyone suggest how I can debug this? I've tried many times to trace the sample app alongside mine to work out how their behaviour differs, but the flow it quite complex and it's difficult to trace through event invocations. I've also tried to disable all the subtleties and complexities of the VS2013 sample in order to highlight the differences, but without success.
More information: I can demonstrate the same behaviour with the 2013 sample application. It turns out that if you change the theme from its initial setting, then the hide/show sequence does not bring back the tool window. This applies whatever is chosen as the initial theme. I'll report this as a bug on GitHub.

Gray code in partial files where suggestions are presented

I'm using Visual Studio 2019 and it grays some of my variables in my codes that weren't grayed in Visual Studio 2017.
For example, if I write "Variable = null" (assuming the specific Variable is already declared and has a value inserted inside) then it grays it and suggests to delete that line.
These suggestions are destructing me, and annoy my eyes as the color of the codes keep on changing.
How can I disable those specific suggestions (and not disabling suggestions totally) or at least not allowing it to become light gray, changing its color to black or not letting it effect the previous color.
How can I disable those specific suggestions
You can disable the suggestion (not just the formatting, but the actual suggestion itself) by clicking the lightbulb icon in the gutter of the editor window (), and choosing the "Configure or Suppress issues" menu item in the popup menu.
For the issue you're asking about, "Remove unused members", that's IDE0051. Select the "Suppress" menu item for that issue, and choose from one of the three options. For keeping the code file itself clean, using the "in Supression File" is best. It will track that particular line of code, but in a separate file, out of the way of the code itself.
Color Theme Designer plugin can solve the problem.
The light gray colour of text can be changed to a colour of choice using this free plugin.
Color Theme Designer can be downloaded from
https://marketplace.visualstudio.com/items?itemName=ms-madsk.ColorThemeDesigner
I haven't found a solution, but I've found something that will be useful for me, perhaps a bug in visual studio 2019 basic themes.
The theme Blue (Extra Contrast) color of the text that's supposed to be grayed - isn't getting grayed, infect it's effected only by the setting of User Members - Locals (and perhaps other user member types, but the colors depend on them and the text isn't getting grayed).

An adornment for the IDE itself

Trying to get started with VS2015 Extensibility. What I have in mind can be classified as an adornment. So I did some research and found sample templates and some MSDN pages that helped me create a basic adornment. Unfortunately though these pages always talk about text adornments that work inside the text editors only, whereas my adornment will work across the entire IDE, so at times visuals might appear on top of the Solution Explorer, or the Toolbox etc. There doesn't appear to be a built-in template for that. Can anyone point me in the correction direction about it?

Is there a way to highlight the currently active code block in Visual Studio 2010?

In Visual Studio 2010, if you hover your mouse over the little [-] minus sign, it will highlight that block of code for you. My question is, is there a way for this block to always be highlighted while you are coding inside of it? That way, as I'm hopping between methods and classes, whatever block I'm currently working on would be highlighted to help my eyes quickly focus.
Is there an option within Visual Studio for this? If not, are there any plugins that do this?
Resharper has some options for this, one will let you outline the braces you are currently in and I think the other lets you highlight the current line
ReSharper is nice, but if you're also looking for something for all kinds of languages, there is Visual Assist X, which also does nice highlighting.
It, too, has the option to highlight matching braces in your current block:
Then you have a line highlighter, either as a simple frame:
Or as a good looking background:
Sadly, there is no option in it to enable a real "block" highlighting like hovering over the [-] button does. :| I also looked for, but didn't find such an option within the Visual Studio options.
Highlight everything you want your eyes to focus on and press ctrl+H.
Or, highlight everything you DON"T want and right click "Outlining" then select "Hide Selection." The short cut for that is ctrl+M
This can be done using bookmarks. The out-of-the-box configuration of bookmarks does not highlight, however this can be changed easily:
Go to Tools – Options – Environment – Fonts and Colors. Under Display Items, select Bookmark. Now change the background color to something, like red. Then go to Tools – Options – Text Editor – General and uncheck Indicator Margin.
PS Bookmarks can be found in the Text Editor toolbar
PS2: To quickly set bookmarks use Ctrl+k+k, but beware of Ctrl+k+l which will wipe out all your bookmarks, it happened to me once!
Adapted from: http://blogs.msdn.com/b/saraford/archive/2007/09/05/did-you-know-how-to-change-a-bookmark-color.aspx

Categories