e.g.
alt enter -> context menu -> Find all 'Redundant name qualifier' issues ->
but now in the new window that lists all those issues in my project, is there a way to fix them all ? (rather than go through them individualy)
ta.
For now, you have to go through the issues individually.
There's an existing request to batch-apply fixes to all similar issues selected in the "Inspection Results" tool window.
Code Cleanup does batch-remove certain issues in any given scope but it's quite limited in the number of fixes it can apply, compared to the number of code issues that ReSharper is able to detect.
Click into a redundant qualifier, alt+enter, then choose from the context menu that lets you fix the issue however thoroughly you'd like.
I'm running ReSharper 8.2.
Yes, you can use ReSharper's "Cleanup Code" to remove redundant qualifiers (amongst other things). This is available from the context-menu when you right-click files, projects and folders in the Solution Explorer window. Code Cleanup will run over all the selected files, reformatting and fixing common issues - it is also customizable.
This is available (in part) in the latest build. If you go to a specific issue in the code editor, click the lightbulb the fix option now has a submenu for some issues that can be applied to the entire solution. Would be cooler if it was available from the Code Issues window, but still a great improvement.
https://www.jetbrains.com/help/resharper/2016.1/Code_Analysis__Fix_in_Scope.html
No use for Resharper Just Go To Visual Studio
Analyze Menu
Code Cleanup Menu
Run Code ....tion
And Complate
Related
I am trying to make VS 2013 stop putting my opening braces on new lines when the code block is not a type. I've gone to Tools -> Options -> Text Editor -> C# -> Formatting -> New Lines and unchecked everything except new lines for types, query expression clauses, and the keyword options.
I hit "OK", and VS STILL keeps putting ALL my opening braces on new lines every time I finish a statement or block or otherwise trigger an auto format. I've even tried restarting VS. No luck.
The settings SAY that they are set to what I wanted, but Visual Studio refuses to obey them. EXTREMELY frustrating. Can anyone help?
Thanks to Lucas Trzesniewski in the question comments, the problem has been found and solved: ReSharper.
I'm working on a machine that another dev was using before me. They installed ReSharper into Visual Studio, which overrides VS's settings with its own. I didn't even know that ReSharper existed--hence my confusion.
For anyone else who didn't know about ReSharper, here's how to set up your opening brace formatting:
Go to Tools -> Options. In the collapsible lists on the left, go to ReSharperPlatformVs12 -> General and click the Options... button that appears on the right.
There will be another set of collapsible lists on the left of the window that pops up. In these, go to C# -> Formatting Style -> Braces Layout.
On the right side, you should find a set of options in a collapsible "Braces Layout" list, each with a drop-down full of all the many ways you can make it treat opening braces for that option. Go ham and set them how you wish :D
I have huge list of constants. I want show where this all constants are used in throughout solution. I can check this (using find in solution) one by one but it will take lot of time.
is their any way so I can achieve this very quickly ?
Regards,
Sachin
There is a complete list of Visual Studio Shortcuts available here https://msdn.microsoft.com/en-us/library/da5kh0wa.aspx. As already mentioned the default shortcut for go to Edit.FindAllReferences is Shift + F12.
Also if you rightclick a symbol in your code you can find the available actions in the context menu (+ hotkeys to use them) which may be easier if you are new to Visual Studio, because the list is quite huge.
"Find all references" is the easiest buit-in way to go, but that requires clicking through them one by one. "Find all references" can be accessed using the context menu or (by default) CTRL+K,R.
If you have VS2013 Ultimate and if your constants are in the same project or in the same file/class, you could use CodeMap. Right click on project/file and select "Show on Code Map". Or select Architecture-Generate dependency graph. This will draw you a graphical view of the usage. For example:
You can then filter this Graph by Project/Namespace/Class level.
Also, ReSharper has built-in analyzing features:
Here's some documentation about ReSharper's features.
May be you can try Alt + F12 [peek Definition]
When opening a Form in the Visual Studio Designer, the generated designer files' contents get mixed up randomly. This includes the files
Form.Designer.cs and
Form.resx
When using a version control system this is a real nightmare.
Is there a way (extension?) that sorts and cleans up all designer files before saving? This would solve most of my VCS related issues with WinForms, as it reverses all the shuffling the designer does.
This problem sure does make merging difficult - I understand your pain.
Read this previous SO post:
"Why does C# designer-generated code (like Form1.designer.cs) play havoc with Subversion?"
Basically you could create a tool to sort all the code alphabetically to give order to the random placement of code, but it is a hack and could involve a lot of pain itself. Personally I recommend changing your work practices to reduce this occurring.
Reduce time between merges
Limit access to a form to 1 developer at a time.
Merge under the guidance of the developer who made the change, as they will know better what looks ok.
Don't open the designer, if you are only making a "code change", ie nothing changes visually.
Undo changes to the designer file before merges, if you are 100% sure that you didn't change anything.
This is not a tip about automatically sorting Form.Designer.cs; however, it does help with avoiding merge help with all modifications made to Form.Designer.cs-files by Visual Studio.
Instead of (or in addition to) changing your work practices (by Jonathon Lee) and especially the constricting "Limit access to a form to 1 developer at a time" do:
Ensure the Form.Designer.cs-file is organized according to Visual Studio in a separate commit before you make the real changes.
Trigger a reorganization of the Form.Designer.cs-file by Visual Studio
(For me, moving a control from one cell in a TableLayoutPanel to an other and back again did the trick.)
Commit Visual Studio's changes and mark them as nothing changed.
Make your modifications to the Form
Trigger a reorganization of the Form.Designer.cs-file by Visual Studio
Commit your changes and describing your work.
Results:
This helps reviewers to distinguish changes to review from noise.
This eases merging:
either, your version control system detects that two commits have the same effect and one is enough and it can merge without conflicts;
or, you manually resolve the conflict by applying just one of the cleanup commits and discard the other.
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).
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.