I have noticed many times developers use like a quick key to generate properties but I can not find what that key is. Is there a list i can look at with all the short keys?. what i am referring to is like when you do
Highlight method + F12 takes you to the reference (for example), there is one specifically that would help me a lot, the property auto complete it usually puts something like
public int something, and the color shows as green or something. Any help would be much appreciated.
This is done with snippets. The default snippet can be expanded by typing prop and then pressing TAB.
I think what you're seeing is CodeRush. If this visual is the green you're referring to, it's CodeRush:
also, if intelisence is ever "not there", simply press control + space. Works in Netbeans and Visual Studio
Related
When I am debugging code in Visual Studio, I can change values of variables by clicking on the overlay that pops up when I hover over my variable of choice. The label which displays the value turns into a text box and I can enter a new value which gets assigned as soon as I hit enter.
What do I have to implement in my own types in order to support this kind of workflow? Currently Visual Studio shouts at me that there is no implicit conversion from string to my type. If I add such an implicit operator it works fine, but is there another way of achieving the same without having to add the implicit conversion to my type (well, I could mark the conversion as [Obsolete]so that nobody can call it from code - but that's not the cleanest way I guess) just like [DebuggerDisplay] can achieve to display something else while debugging while leaving ToString() independent to whatever business logic demands?
The label which displays the value turns into a text box and I can enter a new value which gets assigned as soon as I hit enter.
The workaround you show is the Data ToolTips in the code editor, it is the usual way we edit the value during VS debugging.
Other workarounds I know is that:
(1) Custom the debugging view with the natvis extension.
For example, you could create a type visualizer for a custom data type like the sample in following blog:
https://blogs.msdn.microsoft.com/vcblog/2012/07/12/debugger-type-visualizers-for-c-in-visual-studio-2012/
(2) Use certain debugging window like Watch windows or others, but my understanding it is not convenient, I mean that use the ToolTips(the way you provide) would be better.
https://msdn.microsoft.com/en-us/library/aa6fy2x5(v=vs.120).aspx
Hope it could provide useful information or a path.
I have a situation like that :
is there any way to generate all of those properties at once rather then clicking on each one ?
Whilst strictly an answer to what you asked, as R# can't do what you want, I find NimbleText (http://nimbletext.com/) to be extremely useful for this sort of thing.
You paste your C# into the top panel, add a template to the second panel, using things like $1, $2, etc for the data fields, and the resultant text appears in the third panel.
One of the most useful tools I've ever found, and free too!
What are the key bindings (hot keys) for scrolling through an intellisense list in VS 2015?
For example, in the following say I want to scroll down to "Ceil":
I've tried the arrow keys, pgup/pgdown, Alt-n/Alt-p, Tab, the arrow keys on Numpad with no success. It would be nice to be able to scroll a line at a time, as well as a "page" at a time.
Note: I am using the VsVim extension, so maybe this is the problem? (although I have tried vi-ish keystrokes like "j", "k", "ctrl-j", "ctrl-k" to no effect)
My apologies if this is an obvious question, but I can't find any info about it anywhere, including under
Tools->Options->Environment->Keyboard.
The mouse works of course, but since I'm a vi user I really don't want to take my hands off the keyboard.
Many Thanks.
After three days of receiving no answer, I assumed the answer was not obvious. So I decided to look further on my own. While I was still unable to find any "official" key bindings, I was able to figure out what the problem was, and how to map the keys on my own.
First off, this is only a problem with the VsVim plugin installed. With this plugin disabled, the arrow keys, and pgup/pgdown work as expected. Also, I noticed that even with VsVim enabled the pgup/pgdown is scrolling the list a page at a time. I swear this wasn't working before, but at least now that appears to be working.
I also discovered a few properties of Intellisense that alleviate the need for scrolling. First, intellisense is pretty good about presenting contexutally aware highlighting. For instance, on Mathf I select PI a lot. So whenever I dropdown on MathF, it starts with 'PI'. This somewhat alleviates the need to scroll around looking for something. Second, I also discovered that if you're presented with a choice of Atan and Atan2, for instance, you can logically scroll to Atan2 by typing A2 and then tab completing (instead of having to type out 'Atan2'). So there are ways to logically select certain entries by typing contextual "hot keys" to logicially home in on your "target".
But still, there are lots of use cases where you simply want to scroll a line a time. I noticed that the arrow keys didn't work at all in VsVim -- even when you're just scrolling around the text. I decided I just needed to map the up/down arrows myself using Visual Studio.
To make a long story short, I mapped Alt-j to Edit.LineDown and Alt-k to Edit.LineUp. You can either do this at the texteditor level, or the global level. I just did it at the global level, since Alt-j and Alt-k are not in use by anything else, but if you're mapping a "popular" key binding you can restrict it to just Text editor mode as well.
Do this like so:
Goto Tools->Options->Environment->Keyboard.
Search for key commands containing down.
Map Edit.LineDown to your specified key.
Do the same thing for Edit.LineUp.
Here is a screen print:
Now I can use the vi-friendly Alt-j and Alt-k to scroll through the list. This is even better than the arrow keys because I can leave my fingers on the home row. Yay!
With Resharper 6.1, when I type something like...
widget.PropertyA
and then put my cursor in front of the widget symbol like this...
|widget.PropertyA
and start typing another symbol, R# intellisense pops up. If I choose a suggested symbol, then R# replaces the widget symbol with my newly chosen symbol.
I can see how this might be useful at times, but the vast majority of the time, I just want to type more code in front of widget and don't want it to be replaced. Does anyone know if this behavior is configurable?
Thanks.
I don't believe it is configurable. It seems to be by design that Tab overwrites code. It will even highlight the segment of code that would be replaced.
Instead of hitting Tab to select your symbol, use Enter instead. It will insert the new code without overwriting the existing code.
Go to IntelliSense -> Completing Characters in your ReSharper options. At the top of that menu you can whether the Enter and Tab keys insert or replace.
The only thing you can really do is to insert an extra space before you start typing. You could request that it be changed on JetBrains' bug tracker. Let me know if you do and I'll vote for it!
I am trying to find solution how to hide and unhide comments in VS2010. What i found is:
# region
comments for code
#endregion
and:
http://holyhoehle.wordpress.com/2010/01/17/hide-comments-in-visual-studio/
but this one is not working in VS2010 or i don't know how to...
So maybe any one can help and offer some solution how to hide comments like:
string x = "...." //comment
this extension is no longer maintained
I made a Visual Studio extension that allows you to hide/show comments.
You can get it here:
for Visual Studio 2010-2013
for Visual Studio 2015-2017
You can highlight them one by one, Right-click, and choose Outlining > Hide Selection.
The keyboard shortcut for that maneuver is Ctrl+M, Ctrl+H.
Aside from setting the font color of the comments to the same as the background color (which is what that VS plugin that you mentioned does), there is no way to hide comments.
Multi line comments (prefixed with either // or /* */ are already collapsible, but single line comments are not natively. Your only option for those is to use the Ctrl-MH key chord for a temporary (while the file is open) collapse (as mentioned in #rfmodulator's answer), or remove them altogether.
*The default C# key chord for collapsing all collapsible blocks is Ctrl-MO
You could use this macro to collapse all of the XML comments. I suspect that's about as good as you're going to get.
There is no way other than changing the comment color to hide inline comments and I could see that leading to all sorts of problems.
To hide the selected code or area (first select the area), just use Ctrl + M, Ctrl + H.
This works for any selection.
Using shortcut keys: Simply select your comment or working code and the just press:
Ctrl+M, Ctrl+H -> To hide (this simply collapse your selected section and make small box preview)
Ctrl+M, Ctrl+U -> To uhide