Visual Studio DateTime format in context menu - visual-studio

Pretty specific question, I guess, but is there a way to set the culture for the DateTime formatting in Visual Studio? My specific issue is that I do not live in one of the four countries that actually use PM/AM, so I can't ever remember which is which. Frankly, I don't care to either. Image here to show what I mean:
I just want the formatting to be a sensible 24-hour format instead. Anyone know how to accomplish this?

Related

How to disable reference highlighting in Visual Studio 2022

The problem is displayed in this image.
Changing the item background color for Highlighted Reference helps a bit but they are still highlighted with boxes around them. In the old versions of Visual Studio it was caused by productivity power tools extension and there was an option to disable it. I do not have productivity power tools extension installed on Visual Studio 2022.
There seems to be options to disable this for languages like c#. Is there a way to completely remove this highlighting in editors for "All Languages"?
There doesn't seem to be a setting that turns it off for all languages, however if you change the RBG values to 30 for all three (if you are using the default dark theme in Visual Studio), you can essentially achieve this, since the highlighting will be the same exact color as the background, thus hiding it. To change these, click the "Custom..." button for both the items foreground and background and set the red, green, and blue values to 30. The rest of the values should automatically adjust.
The problem is, Highlighted Reference doesn't cover everything. You probably will also want to set the same RGB values for Highlighted Written Reference and Highlighted Definition, otherwise some things will still get highlighted.
Here is a .gif showing how this works will all three of these settings set to 30 in a C# code file:
You actually have one more Highlighted setting than my Visual Studio installation (perhaps I need an update) and that is the Highlighted Parameter one. Presumably, that controls the highlight of parameters to methods and such. I would assume you'd want that to also be set to 30 for the RBG values.
Also, you may notice that in the .gif it looks like there is a box around the item my cursor is under - that is because of the Highlight Current Line setting. You can also set that to 30 for the RBG values to achieve a 100% un-highlighted experience, but that might be going a bit extreme!

When creating a Visual Studio extension, how can you tell if the mouse if hovering over a comment?

I'm attempting to write an extension for Visual Studio 2019 Community Edition. My goal is that when you hover over a keyword in a comment, it pops up a tooltip. I know how to pop up a tooltip (thanks to this sample). I didn't find an easy way to identify the word I was hovering over, but I brute-force parsed it. So that part's working, as well. The last piece that I need is to know if that word that I'm hovering over is in a comment or not.
// Hovering of THIS_KEYWORD should pop up a tooltip.
var _ = "Hovering over THIS_KEYWORD should not pop up a tooltip.";
I've looked at ITextView and SnapshotSpan and what feels like a million other interfaces in that namespace, but the best I've been able to find is ITextSnapshot.ContentType. That only tells me that I'm working in CSharp. (The documentation on this part of MSDN is sorely lacking.)
I could try to brute-force this one, too... looking for // at the beginning of the line or for a prior /* without a prior */, but then I'd have to extend it for each different programming language. (-- for SQL, ' for VB, what does Fortran use?) The editor itself knows what a comment is; it color-codes them. How can I know?
IClassifier.GetClassificationSpans returns text classifications. You can then check if one of the classifications is a comment.

Is there any extension to edit Visual Studio (2017/2019) theme colors easily

So, I was wondering if someone knows a program (VS extension) that you can for example, click on a button (aka option), than you select what element (in your code) you want to edit, pick a new color and save it...?
eg. you click on void, it says something like, selected Data Types, and a window to edit color. Or you click on a scroll bar, it says something like, selected scroll bar, and so one..
I was looking for it, but all I can find is basically like "Color picker", "Color theme editor for Visual Studio"...
Even if it's not extension, maybe program or web site...
Thanks in advance.
OK... So there is some way to make it easier, but it's still quite boring / hard / annoying task to do. (Works only with Visual Studio 2019)
Download Visual Studio Color Theme Designer.
You'll need some sort of capturing technique (eg. Snipping Tool - comes with Windows 10).
Launch your VS2019 and capture element/color you want to edit.
Extract the hex value of that color (eg. Paint 3D - comes with Windows 10).
Follow the instructions on VSCTD website (Marketplace) on creating theme and when you're done with opening solution, in "All elements" page, paste the value you got, and to make it easier to search, select "Sort by: Color".
Edit the color you think corresponds to desired element and check if that's the color that you were looking for.
Repeat until you're done.
This method is similar to using Color Theme Editor for Visual Studio 2019, but it gives you option to create automatically some theme and then you edit small parts of it (removes the trouble of editing huge amounts of colors)
You can edit color themes for types of keywords for a language in Visual Studio. For example, I've set mine so that interfaces are a light purple instead of the normal blue.
As far as I know, you can't set the colors for a specific object (like have variable 1 in orange, and variable 2 in gray), but you can set the font colors for code types (so structs are orange, and classes are gray).
You can read more about this here.

Changing all elements of highligthed type in visual studio

I use the Productivity Power Tools which highlights all the corresponding elements that are the same as the one being highlighted. As shown below ( "col-sm-6" - purple highlight )
(I think it is Productivity Power Tools doing this. I installed it the same time i upgraded to 2013 , not sure if it is a default setting now)
What I would really like to be able to do is to change all the elements that are highlighted at the same time. So if i want to change "col-sm-6" to "col-sm-4" I want to be able to just hold down a shortcut key which will change all items highlighted.
I have a very strong feeling that this functionality exists.
It seems a lot like the functionality used when you select multiply lines while holding "alt" and then typing.
I have searched around, but cannot seem to find a shortcut for this. I could just do a copy and replace but it would be a lot easier to just hold down "ctrl" while typing.
Yes, it does already exist. If you change a variable name, all the other instances can be renamed at same time (see below). Moment you change the name, a small red bar will be seen below the name -> press Ctrl and click on that bar; it will ask you to change all other instances.
Also, for highlighting a text; there is already a extension ti visual studio present, see here http://visualstudiogallery.msdn.microsoft.com/4b92b6ad-f563-4705-8f7b-7f85ba3cc6bb

Format Time in Visual Studio Report Designer

I have a time field in SQL server that I am trying to display on a rdlc report in visual studio. I would like it to be in HH:mm format but it continues to display as HH:mm:ss. The seconds portion is always zero and I don't want it shown. I thought this would be an easy format fix but none of my expressions seem to work.
Format(Fields!my_time.Value,"HH:mm")
Left(Fields!my_time.Value,5).ToString()
Hour(Fields!my_time.Value) + ":" + Minute(Fields!my_time.Value)
I've never used the report features in visual studio before so I'm hoping I'm missing something easy. Is there someplace other than the format property I should be trying these?
Assuming Fields!my_time is a DateTime field, you can do this:
Change the value of the control where this data is displayed to just use Fields!my_time.Value rather than an expression
Right-click the control and select Text Box Properties
Select Number, then Time in the Category list, then the time format you wish to use
This may give you better results than attempting to format through an expression.

Resources