I've written some messy laid out code, is there a way in VS2013 to re-structure it with the click of a button?
In general the keystroke is CTRL + E, D. However, if you're in an Express version I believe it's CTRL + K, D. But bear in mind this can really determine on how your environment is setup.
It depends on the file type, but Edit -> Advanced -> Format Document often knocks C# and VB.NET files into much better shape. Keyboard shortcut is (usually) Ctrl+E, D.
Resharper, a popular (but not free) Visual Studio plugin, offers a ton of interesting code formatting features as well, whereby you can define all the rules by which code "should" be laid out, then you run one command and it'll clean everything up. You can even save those settings in a configuration file inside the project, so that your whole team can share it.
Ctrl + K + D (Entire document)
Ctrl + K + F (Selection only)
Related
I can use the Ctrl+, shortcut to search for methods but will search among the entire project:
This lists all the classes in all files that have this method, and I want to search only in the current file, similar to Alt+M in VAssistX. Is there a shortcut for that?
I found Is there an easy way to jump right to a method within a file?, but it's for VS2012, and they only suggest Ctrl+F or Ctrl+,.
Note: I'm looking for true navigation, not Ctrl+F, and only within the current file, unlike Ctrl+,.
To expand on the answer by Matt Schley:
Ctrl + F2 -> Tab -> then start typing and it'll sift through the functions in the file.
I know you were probably looking for something else, but this is as good as it gets for what's built into Visual Studio. Maybe there's extensions available.
EDIT
This is a mapping for C#. The command name is Window.MovetoNavigation
For C++, it's default is Ctrl + F8
Not sure if this is what you're looking for, but there is a dropdown menu right above the code editor window that lists all methods and properties in the current file.
Try Ctrl + F2 to active the navigation bar, then tab over twice and you can scroll through the dropdown.
For VS2019 you can use Alt + \ for object search.
From https://learn.microsoft.com/en-us/visualstudio/ide/go-to?view=vs-2019, it says Ctrl+1, Ctrl+M for Go to the specified member. You can add your own combination to this command by going to Tools -> Options -> Keyboard and choosing Edit.GoToMember. For me it works just perfect.
We have a solution with ca. 60 projects.
The standard we have used for namespaces is CompanyName.ProjectName.Area.VisualStudioProjectname.
Now the project has changed name.
Is there a way to change the name of the namespace across all projects, wcf services and service references?
We have ReSharper if that could help.
There are different ways u can achieve this result.
Beginning from ReSharper version 5.0 and above u can simply use
ReSharper -> Refactor -> Adjust Namespaces...
but in your situation I do not think this is what u are looking for.
There is another solution as well simply open one of your code-files select portion of the namespace u want to change hit CTRL + R + R and then rename. it will go through all your project files and adjust and rename new namespace.
the same result can be achieve to update them fairly quickly through the Class View window. Open class view window, click on the namespace you want to rename, hit CTRL + R + R and then rename.
as u mentioned you are using ReSharper so u have everything u need to get the result.
How about a good old Edit / Find and Replace / Replace in Files?
ReSharper -> Refactor -> Adjust Namespaces might do the trick.
Possibly a good use for the Block Sync Edit Visual Studio extension.
In certain cases typing an opening square bracket results in nothing at all. In particular when I want to type them on a variable in the right side of assignment expression:
arr[i] = arr
So I cant type, for example:
arr[i] = arr[9]
It has something to do with Resharper. However, turning of autocomplete and stuff doesn't seem to solve it. Anyone familiar with this problem?
I had the same issue the first time I insalled Resharper.
Look under Tools > Options > Environment > Keyboard to what is bound to Ctrl+Alt+^ (equals to AltGr+[ since I suppose you work on an AZERTY keyboard). Easiest way of doing is by just entering it as a new shortcut.
Remove or rebind the shortcut that comes up and you're good to go.
I had the almost same issue in Visual Studio Express 2012. I couldn't write theese -> } <-.
(Same problem as you, #hazard)
After reading #Bart's answer, I saw that Ctrl+Alt+0 was connected to something called "View.ViewCode". So I removed that shortcut and it worked.
What's weird though, is that I COULD write }s during the first few hours I used VS2012 after installing it.
I have a number of generated .cs files (originating from WSTL files). ReSharper isn't happy and I'm getting so many errors/warnings that its tough to separate the signal from the noise.
Is there a way to work around this? Can I suppress all the warnings/errors in an easy way?
My goal is to keep from (or minimize) changes to the generated files.
Turn code analysis on/off => Ctrl + Shift + Alt + 8 (with Visual Studio key bindings; otherwise it could just be Ctrl + 8 )
There are different ways to mark code as generated in Resharper the documentation explain them all but i guess that for your case changing the name of the files to match the default *.generated.cs would be the simpler.
Is there a way to issue a key command to properly format an entire file in VS2008 with CodeRush Express?
Use Ctrl+K+Ctrl+D to format document keystroke
Use Ctrl+K+Ctrl+F to format selection keystroke
It's also possible to set your own keystrokes by opening Options... dialog (select Tools->Options from the menu). In Options dialog select Environment->Keyboard form the tree and set your own shortcuts for Edit.FormatDocument.
You could always go to Tools -> Options -> Keyboard and give the Edit.FormatDocument a new shortcut.
Update You can also see what the Shortcuts mapped to this command are this way.
Ctrl+K,Ctrl+D
This question with answers has a lot of handy tips.
If Ctrl+E+Ctrl+D or Ctrl+K+Ctrl+D or Ctrl+K+Ctrl+F doesn't work for you, try to set below settings:
Tools->Options -> Text Editor ->C# ->Tabs,
make sure `Keep tabs is selected.
Then, go back to your text editor, re-try formatting.
I was really annoyed before, and steps above works for me. hope it works for you guys..
Just select all content of page by Ctrl + A then click Ctrl + K and Ctrl + D.
The whole page tag format.
For example see this link:
Format the content
Shortcut in visual studio to format the whole document is Ctrl + E, D
I just use built-in Visual Studio formatting command: Ctrl+A, Alt+F8
Ctrl+E+D in Visual Studio Express 2013.