Code editing in Visual Studio like it is in Aptana Studio - visual-studio

Is there any plugins to Visual Studio that enables you to have the wonderful type-style you get in Aptana Studio, ie:
Auto brace completion
Auto indentation of braces (and other characters) whenever 'enter' is pressed inside the braces, like so:
Before enter:
{*}
After enter:
{
*
}
Is it possible to make this work in Visual Studio (via plugin or otherwise)?

You can use, for instance, Resharper, http://www.jetbrains.com/resharper, which is a pay-for plugin for code style, code refactoring and formatting. Rather advanced.
There's also Visual Assist X, http://www.wholetomato.com/, as well as JustCode, http://www.telerik.com/products/justcode.aspx and a whole lot more. Several products available, most of them for money, most of them good. =)

Check Productivity Power Tools. It has plenty of nice stuff:
Auto Brace Completion
Quick Find
Enhanced Scrollbar
Searchable Add Reference Dialog
and others.

Related

Refactor on save in Visual Studio 2019

I love Prettier for VS Code. I want to do similar things in Visual Studio (2019).
It now has 'Wrap, indent, and align parameters or arguments' for example (https://learn.microsoft.com/en-us/visualstudio/ide/reference/wrap-align-indent-parameters?view=vs-2019); and I'd like to do this automatically whenever I save the file.
Does anyone know if this is possible? Or if there's a free extension that can do this?
Mads Kristensen (a Microsoft employee who makes scads of Visual Studio extensions and teaches you to too!) made a JsPrettier extension for "classic" Visual Studio (ie, not VS Code):
https://github.com/madskristensen/JavaScriptPrettier
It does not format on save if you set that up in its settings.
If it's literally Prettier in Visual Studio that you're after, this isn't a bad option.
I don't know of a free plugin but you can get quite a long way towards this with some muscle memory and the built in autoformat command.
CTRL+E, CTRL+D, CTRL+S
will do code indentation and formatting, and save the file.
If you have Resharper (sorry), there's a configurable code cleanup tool which will do what you want and CTRL+E, CTRL+F, CTRL+S will do the cleanup and save.
The Format document on Save VS extension does exactly what you want, with one exception. It automatically runs Visual Studio's code cleanup command on save.
Visual Studio's code cleanup commands covers many code style preferences and can be configured with a .editorconfig file. Unfortunately one thing that is not supported by VS yet (not counting Resharper) is line wrap preferences. There is an open ticket for this: dotnet/roslyn#33872
If and when Roslyn supports line wrap preferences (presumably as a new .editorconfig preference), then Visual Studio code cleanup will enforce it and the extension will apply it on save.

IntelliJ and Visual Studio select and rename a variable in multiple places by a shortcut behavior as 'Ctrl+D' in Sublime?

Because of the lack Intellisense in Sublime, I prefer to using Visual Studio to code C# and Pycharm to Python.
ctrl + d in Sublime can select mutiple same word in text. So I can alter the selections on same time. It is convenient to alter the name of same variable in a function. How can I do that in my other editors?
The Ctrl-D multiple selection tool is one of its greatest features of Sublime Text 2 and is sorely lacking in other editors and IDEs.
Visual Studio doesn't have it built-in but there's a MultiEditing plug-in for it.
IntelliJ, which PyCharm is based on, doesn't have it either but it's apparently being planned for a release that should be out soon. See this blog comment (and the link in it) for more.
Meanwhile, you can use the rename refactoring tool in Resharper (for Visual Studio) or in PyCharm. It's not the same as multiple selections but is very useful functionality in its own right.
A nother IDE that does support it is Webstorme - alt+j. you can read the stackOverflow discussion about it here : How can I select next occurrence in IDEA editors
I just tested it on Webstorme10, and it works perfectly, just like in Sublime.
Try ctrl + h. It is the standard shortcut in many editors for replacing text.

Coderush express seems doesn't work

I installed Coderush express and I can see that it is installed. (I can see that Camel Case Navigation works). But I can see any other feature works. Based on this page: http://community.devexpress.com/blogs/markmiller/archive/2009/06/25/coderush-xpress-for-c-and-visual-basic-2008.aspx
I cannot see any of these feature to works:
Tab to Next Reference : no effect when I put caret on a variable and press tab ( a tab inserted at the middle of my variable name!)
Highlight All References: pressing ctrl+alt +u add a ascii character to source code.
Quick Navigation: Ctrl +Shift + Q has no effect.
Quick File Navigation : Ctrl +Alt +F brings up F# interactive
Selection Increase and Selection Reduce doesn't work: generate a beep
Declare: ctrl +` has no effect.
and ...
Any idea why this is happening? I am using VS2010.
Presumably due to your using a different version of Visual Studio.
The page you linked to is pretty clear about it being for Visual Studio 2008, but you've included the visual-studio-2010 tag.
CodeRush Xpress fully supports all language features of Visual Basic and C# in Visual Studio 2008.
Edit
Version of Visual Studio wasn't the problem after all.
It appears to just be that the tool makes very little visible change to the Visual Studio user interface, so it looks like it hasn't loaded.
It seems that your installation is corrupt. I would recommend you contact DevExpress Support directly. The support team is better equipped to resolve any issues you face with their products. They offer a very short response time and high qualification. I would also recommend that you reinstall the product.
The features you are asking about, were removed on purpose from VS2010 version of Coderush XPress. More info here:
Experience with Coderush XPress and Visual Studio 2010?

Highlight all occurrences of a selected object with ReSharper

I was used to use RockScroll (or MetalScroll), but when I started to use ReSharper my RockScroll start to show some bugs. Well, this is scope to another discussion https://stackoverflow.com/questions/1089493/is-rockscroll-compatible-with-resharper.
But my problem is related, because now without MetalScroll I can't highlight all occurrences, what I consider very useful in many situations.
Someone have another plugin for VS2010 or for ReSharper that do the same or better?
I think you are looking for "Highlight usages in file" This can be access via Shift+Alt+F11 or Ctrl+Shift+F7 depending if you are using VS key bindings or InteliJ bindings. Use either Ctrl+Alt+Up/Down or Ctrl+Alt+PageUp/PageDown to go to next and previous highlights.
You can also use the Ctrl+Alt+G combo to bring up a menu of what to jump to. This can be used to move the cursor to the next occurrence.
You should try Productivity Power Tools for Visual Studio 2010. There are other versions, at least one for Visual Studio 2013 and another one for Visual Studio 2015.
It plays nicely with ReSharper and has this selected text matches highlighting both in the editor and the scrollbars among many other features.
Try the visual studio extension RockMargin which highlight the occurrences on double click (like most IDEs). Works fine with VS 2015 and ReSharper.

Highlight all references to X?

The Eclipse IDE has a neat little feature that I really miss in Visual Studio.
If I place the cursor on a variable or method name, the IDE will automatically highlight all references to it in the current document within the relevant scope.
I can't seem to find an option to turn on similar behaviour in VS2008 or Resharper 4. I know VS has a Find Usages function, but I'd like to do it automatically on the fly.
Does anyone know of a free addin which will add this functionality?
If you're using ReSharper, you can highlight the usages in the file with Shift-Alt-F11. Place your cursor on the variable you want to find usages of, and press the Shift-Alt-F11 combination.
There is an add-in for Visual Studio that will do something similar called RockScroll.
When you double click on something, it will highlight all occurrences of the item you double clicked. It also changes the vertical scrollbar to a "syntax highlighted thumbnail view" showing an overview of where the item occurs in the file.
I know you mentioned ReSharper, but CodeRush has a nice references window that you can dock and let it search for things on-the-fly or on demand. As a bonus, you can select each usage and it will show you the context surrounding the usage. It also works for methods.
I mentioned CodeRush since they have an express edition, which looks like it includes that feature, but I haven't tried that edition.
Visual Studio 2010 has sorta implemented this, but the feature is somewhat lacking. There is a non-configurable delay between placing the cursor and highlighting.
The RockScroll Addin is not available for Visual Studio 2010 and above.
As a replacement, the free "Highlight all occurrences of selected word" plugin will highlight all occurences of the selected string after a doubleclick. There is no delay as with the native vs2010 highlighter.
It is string-based, which means it works inside comments and string literals.
Microsoft published a tool that sort of does what you want.
Some of my favourite features:
Enhanced Scrollbar
Auto Brace Completion
Ctrl + Click Go To Definition
Open Containing Folder
and the list goes on.
For Visual Studio 2010 and for Visual Studio 2012

Resources