CodeRush - Do That Suggested Fix - (shortcuts) - c#

What is the keyboard shortcut to get CodeRush to do the #1 suggested fix for the situation?
Do I really have to hover over the problem long enough to get the ellipse to show up and then pick a choice?
Also is there a way to jump to the next problem area?

In the DevExpress options (under DevExpress > Options), there's a "IDE" section and a "shortcuts" subsection.
In there, you probably already have a keyboard shortcut defined for in the "Refactor" category for the "Refactor" command - that keyboard shortcut would bring up that selection box, and pressing Enter will then select the first option in that dialog box, by default.

If you notice a delay contact support#devexpress.com and send some details to help us reproduce. Also, CodeRush doesn't interfere with Intellisense, but uninstalling other third-party IDE tools has been known to suppress Intellisense and this may be what happened to you. Try this: Open up the Visual Studio Tools menu then Text Editor and then C#. On that options page you will need to recheck "Auto list members" and "Parameter information" to get Intellisense reenabled.

Related

Turn off any IntelliSense, compiler notices and warnings, and suggestions in Visual Studio 2019

I need to present a C# application's code as part of a presentation and it must be presented in the IDE itself. Thus, I want to disable any IntelliSense / compiler notices / warnings / code suggestions that might pop up mid-presentation, leaving only color coding.
For example, I do not wish dotted green and blue lines under fields like so:
How can I turn those off, and how can I turn them back on after presentation?
(Note: I use resharper for C#.)
There is no easy way to fully disable IntelliSense in Visual Studio. However, you can turn off (most of) those features that you want to hide.
For example, to prevent the display of those squiggles (for errors and warnings), use the following.
From the "Tools" menu, select "Options." In the pop-up, open the "Text Editor" node in the left-hand window and select the "General" sub-option. Then, in the right-hand pane, uncheck the "Show error squiggles" box.
You can disable/enable (many) other 'annoying' features in a similar manner, although finding where to do so is not always trivial. Remember to look also in the "All Languages" and "C#" sub-nodes (in the left-hand pane) for other features to disable/enable.

Stop default Autocomplete behavior when hitting spacebar

NOTE The keyword here is "default". I know I can hit escape and the default behavior gets aborted. I don't want to hit the escape key every time the IDE thinks it knows what I want. I didn't have to do this in 2013.
ADDENDUM 2 It seems I'm still having difficulty communicating what I'm after here. What I want to happen is nothing when I press the space bar... I just want a space character to show up on my screen. The only time I want the IDE to actually insert a suggestion is when I hit the tab bar. I hope that's clearer?
This is driving me nuts. 2013 and before allowed you to set completion characters (maybe that was resharper?) But in 2015 I see no way to stop the default behavior of autocomplete.
For example, say I have a class Foo, but I don't have the namespace specified already, yet I have a class FooBar in one of the specified namespaces, if I type:
public void DoSomething(Foo// <-- then a space)
...it automatically puts FooBar. How the heck do I turn off this behavior?
I should mention that I still want Autocomplete, just on tab though.
Edit -> Intellisense -> Toggle Completion Mode
From : https://msdn.microsoft.com/en-us/library/hcw1s69b.aspx
"You can also change to suggestion mode, in which only the text you type is inserted into the code. For example, if you enter an identifier that is not in the list and press TAB, in completion mode the entry would replace the typed identifier. To toggle between completion mode and suggestion mode, press CTRL+ALT+SPACEBAR or click Edit/IntelliSense/Toggle Completion Mode."
For all who have the same problem in Visual Studio Code, add this line to the User Settings:
"editor.acceptSuggestionOnCommitCharacter": false
change the setting for Editor: Accept Suggestion On Enter to off
If you're using Resharper and Visual studio 2017, you may need to use a combination of the existing answers to stop getting the autocomplete behaviour when pressing space. This is too long for a comment so added an answer.
Make sure in Visual studio that intellisense Toggle Complete Mode is off/unselected (as noted in other answers). Note: If you turn on the "Text editor" icons in the VS toolbar at the top, you'll see an extra icon that gets highlighted on and off showing you whether intellisense is toggled on or off.
AND
In the resharper dropdown on the toolbar (Resharper > Options...), Go to IntelliSense > Completing Charactes > and then uncheck the "Complete on space" box for C#.
Now autocomplete doesn't occur when pressing space (can still use tab, etc to autocomplete).
(Related aside: This autocomplete on space is really bad if you use VSVim, because you can't by default use the typically vim ESC key to 'get out' of the autocomplete mode. e.g. it's very difficult to even type in the static modifier for a variable/function without it changing to some other autocomplete choice.)
If you use Vs2017 and the setting resets everytime you launch Vs, i created a small script that automatically disables space completion at launch using Visual Commander Extension:
enter link description here
Visual Studio 2019 Pro -> Options -> Text Editor -> Advanced -> disable "Responsive code completion"
This disables Completion Mode, but doesn't take effect when VS is restarted.
You have to enable & disable it again after each restart, which is worse than using the Toggle Completion Mode menu option.
Since it is in Options, it is probably supposed to be a permanent setting.
Since Visual Studio is constantly changing, I imagine there will constantly be new answers for this. None of the other answers worked for me on Visual Studio 2019 Community Edition. What did work (as of January 2022) was:
Edit > IntelliSense > Switch between automatic and tab-only
IntelliSense completion
Alternatively, you can just toggle it with Ctrl+Alt+Space. Hopefully this helps someone else. Also, I've noticed Visual Studio doesn't seem to remember this setting, and I've had to toggle it again the next time I used VS.
For those looking for the same thing in VSCode (2022)
File -> Preferences -> Settings and search for Accept Suggestion On Commit Character.
Make sure this setting is unchecked:
For the current version of Visual Studio Code (2020), you can change to suggestion mode by going to File > Preferences > Settings and then going to Extensions > TypeScript and then checking TypeScript: Disable Automatic Type Acquisition. Or, after going to Settings, you can search for "Type Acquisition" in "Search Settings" and then check TypeScript: Disable Automatic Type Acquisition.
Default IntelliSense completion mode
Another option for VS19 Enterprise:
Visual Studio 2019 Enterprise -> Options -> Text Editor -> Advanced -> Default IntelliSense completion mode -> Dropdown -> Tab-only
I just did this in Visual Studio by going to:
File > Preferences > Settings > toggle "Suggest on Trigger Characters"
I also toggled off "Auto Suggestion on Commit Character" and "Accept Suggestion on Enter"
- however you may want those settings.

Resharper Active hotspot disabling intellisense

Sometimes I get this red box which disables intellisense and I have to press Esc a few times to get it back. Not a big deal but it gets annoying after a while. Anyone know how to disable whatever this hotspot thing is?
http://postimg.org/image/x61y97y3t/
You are using a ReSharper 'if statement' template it seems. you typed if and pressed tab probably. You are supposed to enter a value in the red box and then press tab. (other template require more steps to complete)
ReSharper > Options > IntelliSense > Completion Behavior > Replace keywords with Live Templates
Turning this off made the usual completion available again in IntelliSense while leaving the Live Template as an option farther down.
The other option is to hit CTRL + Space while in a Live Template to activate the "normal" IntelliSense.

Can I add some comment while debugging my application?

Is there a way in Visual Studio to add some comment to my code while I am executing debugging?
If I try to do it Visual Studio tells me that changes are not allowed.
Searching on Google I found many people that ask about this feature but I can't find a real solution to insert some comment into my code (only bookmarks).
Is it impossible or is there a way to accomplish this operation?
I know that in Java (using Eclipse) I can do it and it is very comfortable
Why not use the bookmark feature of visual studio?
Look under Edit->Bookmarks->Toggle Bookmark. On my machine that's a shortcut of holding Ctrl and tapping K twice.
There are shortcuts for previous/next bookmark, disable all, etc, etc.
You can also see a list of all bookmarks in the Bookmark Window (under the View menu) which allows you to name your bookmarks...
If you have enabled Edit and Continue (E&C), you should be able to edit code while your program is in break mode, e.g. you've hit a break point. It should be enabled by default, but if for some reason it isn't, you can read how to enable E&C here. For 64-bit applications, support for E&C was added with .NET 4.5.1.
If you just want to add comments as a deugging aid, i.e. not 'real' code comments, you can use a datatip aka pinned watched window's comment. Hover your mouse over a variable until the watch window pops up, pin it (top button) then expand comments (bottom button) and type whatever you want. These pinned windows are retained in between debugging sessions, and so are your comments. Combine this with bookmarks for quick navigation (Ctrl-k-k, Ctrk-k-n). Shown in action here, additional info here
Sure! you can both add comments to your codes and even modify your codes while debugging your application.
But, remember: you should Enable and Disable Edit and Continue(see here) as khellang said, and check you are in break mode(rather than debug mode).

Where is the shortcut "Open in Blend" in Visual Studio 2013?

Sometimes I see the shortcut sometimes I don't. I'm not sure why.
How can I make the shortcut permanent?
I believe I have an answer. It worked for me flawlessly. After being frustrated, I wrote to MS through the Feedback option in VS2013 (at the top). A week later, one of their employees responded with this:
Hi,
Thanks for raising this issue to us through the Visual Studio
Feedback program. I am interested in helping investigate the issue
you’ve described. After creating a new WPF app in Visual Studio 2013
RTM, I was able to reproduce the issue you’ve described. By default,
.xaml files do not have the “Open in Blend…” command enabled in the
context menu in the Solution Explorer. However, I was able to
successfully add this command in both VB and C# WPF projects in VS
2013. It sounds like you might have also tried this method, but please try the steps below and see if you are able to successfully add the
command. I hope that step #6 might be the trick in successfully
enabling the command for you. In order to add this command, I
followed these steps:
Tools > Customize
Select Context Menu radio button
From the Dropdown, choose “Project and Solution Context Menus | Item”
Click the “Add Command…” button
Select View category
Select the third (bottom-most) “Open in Blend…” command (there should be three available)
Close dialogs
Right click MainWindow.xaml
Select “Open in Blend…” (it should not be grayed out)
Of the three “Open in Blend…” commands available, the third one is the
only one which successfully worked on .xaml files in WPF projects. The
other two would be grayed out when I tried to use them. Please
contact me to let me know if you are able to successfully add the
command or if you still see the issue. I look forward to your
response, and I hope that this will successfully resolve your issue!
Thank you,
Scott Rick
I am impressed by the fact that he gave much consideration to this issue and actually tested several methods. In my case, there were two "Open in Blend..." items, so I chose the second one and it worked flawlessly.
Hope it works for you as well.
You can customize it:
Keyboard Shortcut: how to
Integration in context menu:
Tools->Customize
Click on Commands tab
Click on Context menu and choose "Project and Solution Context Menus | Item
Click on Add Command
Select View as Category
Select 'Open in Blend' command
You get this context menu option now for every item but that should not hurt...
When working on a Silverlight, Windows Phone or Windows Store app project, you can use the View -> Open in Blend command to open your current active tab/code XAML window in Blend.
The above menu choice is not available for WPF apps only. No idea why.

Categories

Resources