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).
Related
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")
When using Visual Studio 2015 Community Edition my cursor frequently disappears when I perform the Ctrl+. shortcut to resolve missing dependencies. For example, if I am creating a new Entity Framework entity and want to add the [Required] attribute to one of my properties:
Type [Required]. The attribute gets a red squiggly underline.
Click Ctrl+. to bring up the suggested imports
Select the using System.ComponentModel.DataAnnotations option using the arrow keys
Press Enter to select it and import the using statement
Sometimes I can continue coding without any issues. But most of the time my cursor disappears and I have to click back on the code editor to get my cursor back.
It happens to me on several different computers using Windows 7, Windows 8.1, or Windows 10. I've tried resetting my VS2015 configurations to default, but it didn't seem to help. The only other thing I can think of that might be worth mentioning is that I'm use the Dark theme.
Has anyone else experienced this? Is there a setting change so that the editor keeps focus, or a keyboard shortcut to get the cursor back? It isn't the end of the world to use the mouse but I never had to do it in 2013 so it is slightly annoying.
I ran into the same issue, and found that if I went to my mouse properties and changed the default pointer for Text Select to one with white in it, I didn't lose the pointer in the editor. I don't know if this'll solve your issue, but it helped with mine.
I've had this problem as well, for me it seemed to be a glitch with the touch screen capabilities on my laptop. The cursor would disappear when using the track pad and moving into the work area in VS, and come back when I moved it outside to like solution explorer or similar.
Easily resolved by tapping the screen.
I had the missing cursor issue in VS 2015 Community Edition and it turns out the culprit was the Gotomeeting client software running on my desktop. I was accessing VS 2015 in an RDP session and as long as Gotomeeting was running on the desktop running the RDP client my VS 2015 cursor in the RDP session would disappear randomly.
I had the problem that the blinking cursor completely disappeared in Visual Studio 2017 (and probably other places as well). Found this old block post, that helped me:
I found the cause of the problem. I had also noticed that I did not have a text cursor (caret) in programs like Windows Live Mail. Somehow my caret size got changed to zero. The solution in Windows 7 was to go to Control Panel, Ease of Access Center, Make the computer easier to see, and under Make things on the screen easier to see set the thickness of the blinking cursor to 1 (mine was displaying a blank field). After applying the change, the text cursor displayed fine in Visual Studio Editor and Windows Live Mail.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/c7ba185e-1840-4649-984e-c12d5525baa2/cursor-not-visible-in-visual-studio-editor?forum=vseditor
None of the (many across web) posted solutions for the disappearing cursor worked. I found a solution that works for me go to:
Tools/Options/Environment/General/Window layout
there are 2 radio buttons:
Tabbed Documents
Multiple Documents
You must select one or the other. I switched to Multiple Documents and this solved the problem.
Details: this problem manifests when changing the focus to any other open window/application via Alt+Tab. On return, Vis Studio has no cursor visible. Ctrl+Tab is a sorry workaround, yet effective. But this fix is totally sat for me.
Try pressing the "insert" button. You might need to hold down the "fn" key for this.
I'm trying to get my colors set up in Visual Studio 2015 the way I like them and there are still some things that are colored different from the way I like. Is there a general purpose way to find out what the Visual Studio editor is classifying a token as?
Alternatively, two things I'm trying to change the color of are the C# global namespace keyword (it doesn't count under Keyword) and the highlighting of some refactoring suggestions. If someone knows the name of the color setting controlling these, that would solve my immediate problems.
Edit: Here is a screenshot showing these two examples.
"global" is purple instead of blue, as my keywords are set. "Attribute" is grayed out instead of solid because of a refactor suggestion which appears if I mouse over it.
I'm using VS 2013 and have some Razor code that has a weird background colour:
I want to get rid of the gray background to match the black background so it doesn't stand out so much, but have no idea which display item this is when I go to Tools->Options->Fonts and Colors. There are hundreds of settings in there, and the few that I thought represented the code (like keywords, etc) did not change the background.
Is there a quick way to determine what type of display items these are? I tried right clicking to no avail.
Any help would be appreciated!
EDIT: Ok, so I found the setting, it was Resharper error highlighting, so I have it fixed, but I'm still wondering if there's a good (easy) way to find the setting versus 15 minutes of trial and error.
It's the setting in there called "Razor code":
Setting that sets the background color. For example, Lime:
You can click "Custom.." and choose a more appropriate color that is closer to your editor background.
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