How to force resharper 6.0 to use tab instead of spaces during code clearup ?
ReSharper uses VS settings, it doesn't have own settings for this task.
Go to Tools->Options->Text Editor->Necessary lang or All Languages->Tabs and select "Insert spaces" or "Keep tabs".
This is a bug in ReSharper. It typically uses the VS settings, but when aligning it always uses spaces and ignores the VS settings (particularly the Smart Tabs).
A request for a fix to this has been around since version 4, but is still not fixed in verstion 6 (the most recent release).
The bug is noted here: RSRP-150306
and here: RSRP-200204
Update: One thing you can do to work around this issue, after doing the ReSharper cleanup, you can use the VS formatting call to have it fix the tabs/spaces. The default shortcut for this is
Ctrl-K,Ctrl-D for the entire document
Ctrl-K,Ctrl-F for just the selected text.
Another option is to install the Productivity Power Tools package (through NuGet or here) and then enable the 'Fix Mixed Tabs' option which offers you an option to Tabify or Spaceify files when it senses a mixture.
Related
In Visual Studio 2010 and earlier, the Find in Files feature remembered your selection for the "Look in" option.
In 2012, the option sometimes gets reset to "Current Document", making it only search in a single file. This can be annoying, particularly when you don't notice it's done it.
Is there any way I can force this setting to stick with what I want it to be (generally "Entire Solution")?
As an example of the problem, highlight a few lines of text in a source file and bring up the Find in Files box. It will have changed the "Look In" setting to "Selection". Close it, deselect the text and do Find in Files again. The setting will have silently reverted to "Current Document". Doing this in 2010 and earlier doesn't change the setting.
There's another description of the problem here.
I find that its intermittent (but more often that not) and that its a potential bug. For me it resets to "All Open Documents" which could be far more disastrous.
Do you have any plugins installed as I was thinking of raising this as an issue with vs if its not a 3rd party tool affecting it?
I have the following installed:
Resharper 7.1
Teamcity
Ankh
Entity Framework Power Tools Beta 2
Ghost Doc
Microsoft Web Developer Tools
NestIn
NuGet
Spell Chekcer
SQL Server Compact Toolbox
VS Extensions for Windows Library JavaScript
I guess we should rule out some of these first?
Anyone else find this who has no extensions installed?
Try if the SmartFind extension helps in your case. I wrote it because I had a similar problem.
http://visualstudiogallery.msdn.microsoft.com/015611c4-b357-4672-8977-f3ec92f0b808
Source is here: https://github.com/laktak/vs-smartfind
What worked for me is under keyboard customization i made it so Ctrl-Shift-F maps to Edit.SwitchtoFindInFiles instead of the default (Edit.FindInFiles). I did also install the SmartFind extension (mentioned above in this tread) but by itself it didn't seem to fix it. I'm not sure if it's the combination of the two that fixed it in my case. Also note that this applies to VS2012 so YMMV.
I always use ctrl + f to search in document and ctrl + shift + f to search the entire solution.
Might not be an answer to your question, but it should solve your problem.
Is there a built-in feature or available add-on for Visual Studio 2010 that will clean up spacing in C++ code so that annoying blocks like this:
RandomVar=RandomList.RandomMethod();
will become
RandomVar = RandomList.RandomMethod();
(Same goes for spacing in loops, etc.)
...or do I need to do this myself with find/replace and regex?
I think You are looking for Edit->Advanced->Format document. This will re-format your current document according to settings in Tools->Options->Text Editor->c/c++->Formatting.
It's keyboard shortcut Ctrl+E+D in my case.
Although originally for C code formatting lint has been modified to cover C++ and ported to many platforms.
Some lint variants only report inconsistent layout, others can fix it for you. some are free others paid for versions.
This would be an outside the IDE fix as this is a sperate tool (at least traditionally it is!)
This wikipeadia article lists a few possible sources for lint tools
(this was a footer in my orginal question, but as that posed two solutions I extracted it here so you can accept a specifc answer should you find one apropriate)
This is not a proper "Solution" but a possible work-around without the need for finding external tools
In the "Tools" menu pick "Options..."
In this dialog navigate to
"Text Editor -> C/C++ -> Formatting"
Set the layout options as you
would like your code to look.
Click OK.
Now in a unit with "bad"
formatting from the menu select "Edit->Advanced->Format document" and the IDE wil reformat the
document to match your settings.
For C#, VB etc the "Formating" option has several sub nodes that provide a fine grain of control for the sort of spacing options you ask for. The list for C/C++ is flat and very limited by comparison. I suspect there is not enough flexability for the layout you want.
So you probably cannot get the formatting you want directly. How about...
Set the spacing rules you want for C++ in the C# settings
Temporarily adding a C# project to your solution
adding a class to that
emptying it.
paste the C++ in (causing a reformat)
copy back to the original file
rinse and repeat
remove the temporary C# project
I have to say this is not pretty, but given the syntactical similarities between C++ and C# its probably a close match.
The auto-formatting settings for C++ in Eclipse are more extensive than in Visual Studio, so I ended up using that instead.
I'm using VS 2010 with resharper. If I have a class called ConfigParserTests and then write
new ConfigParser(
the code will auto complete to
new ConfigParserTests()
which is not what I want. Any idea how to disable this nasty feature.
[Edit]
What is want is to write out
new ConfigParser()
without pressing "Esc". In this case I am using TDD so ConfigParser does not exist.
[/Edit]
I have been looking around in both the resharper and VS intellisense menus without finding anything helpful.
Open Options window, navigate to Intellisense > Autopopup. You will see auto-complete options correspond to several cases and categorized according to language:
As you see, you can select for each single case:
Do not display.
Display but do not preselect. (seems proper for your case)
Display and preselect. (default)
Different options may be selected in different cases or languages. For example, you can specify different behaviours in C#:
After dot
After 'new'
In doc comments
Letter and digits
Where value is expected
HTH
It's not clear whether you're complaining about which class name it's filling in, or the parentheses. I'll address both.
If the class you're trying to use is in another namespace, and you haven't added the appropriate using yet, then the code completion is doing just what you would expect -- you told it which namespaces to use, and you didn't tell it to use the one with ConfigParser in it; so it uses the nearest match, as expected.
But ReSharper has shortcuts that can save you work by finding the class and adding the using for you. For this case, I would suggest that you look into the different Ctrl+Space options in ReSharper. You could write new cp <Ctrl+Alt+Space> and ReSharper will give you a pop-up menu asking whether you mean ConfigParser or ConfigParserTests. When you hit Enter to select the one you want, it will add the necessary using to the top of your file, and complete new ConfigParser() with the cursor between the parentheses.
(If the ConfigParser class doesn't exist yet, then that's one of the cases where you don't want code completion. Just type new ConfigParser and then hit Esc before typing your open paren.)
If your problem is that it adds a close paren, be aware that if you type ) ReSharper will not add a second close parenthesis -- it will recognize that you're typing a paren that it already added, so it will just move the cursor to the right. If for some reason you still don't want it to complete the open paren for you, #jdv-Jan de Vaan's answer explains where to change this preference.
When doing TDD you should put the VS intellisense into suggestion mode instead of the normal completion mode.
The difference is described here
Unfortunately Resharper takes over the intellisense so you can not change mode without deactivating resharper.
Select Resharper \ Options. From the list on the left, select Enirionment \ Intellisence \ Completion behavior.
Then disable the checkboxes under "Automatically complete single item with:"
If you are using resharper 6.0 I would upgrade to 6.1 as there were a lot of these sort of preselecting bugs introduced in 6.0 and fixed in 6.1.
CTRL+ALT+Space Bar
Gotta give props to Zain for showing us how to get around these issues when utilizing TDD
http://blogs.msdn.com/b/zainnab/archive/2010/01/22/intellisense-suggestion-mode-vstipedit0012.aspx
Select Resharper \ Options \ Environment\ Intellisence \ Completion Behavior
Then Change the options under “Automatically insert parentheses after completion: can disable all together Really Old Man Voice I want to type my own (), Opening Only, or Young Hip Coder Dude I like resharper to do it all for me man
I have been searching for an hour and cannot seem to find any information whatsoever about a word wrap / line wrap option in the new Aptana Studio 3 Beta (aka RadRails 3 Beta). I can't find an option for it anywhere in the Preferences. The lack of a line wrap is killing my productivity. Can anyone shed some light on this please? I can't imagine that an open source project as high-profile as Aptana would lack such a generic and necessary option.
In the latest version of Aptana Studio 3, you can enable word wrap from the preferences. Try going to Preferences > Aptana > Editors and check off "Enable Word Wrap"
Right click in the code panel and check "Word wrap".
Took me ages to find but it is there!
It isn't a standard feature but you can use a work around outlined on the below links,
https://aptana.lighthouseapp.com/projects/35272/tickets/1650-add-word-wrap
http://ahtik.com/blog/projects/eclipse-word-wrap/
http://wiki.appcelerator.org/display/tis/Installing+a+Studio+plugin#InstallingaStudioplugin-InstallingNonStudioPluginsonEclipse3.5
I sure hope word wrap makes it into the final release b/c it is the only real issue for me using Aptana 3
I coded a Mancala game in Java for a college class this past spring, and I used the Eclipse IDE to write it. One of the great (and fairly simple) visual aids in Eclipse is if you select a particular token, say a declared variable, then the IDE will automatically highlight all other references to that token on your screen. Notepad++, my preferred Notepad replacement, also does this.
Another neat and similar feature in Eclipse was the vertical "error bar" to the right of your code (not sure what to call it). It display little red boxes for all of the syntax errors in your document, yellow boxes for warnings like "variable declared but not used", and if you select a word, boxes appear in the bar for each occurrence of the word in the document.
A screenshot of these features in action:
After a half hour of searching, I've determined that Visual Studio cannot do this on its own, so my question is: does anyone know of any add-ins for 2005 or 2008 that can provide either one of the aforementioned features?
Being able to highlight the current line your cursor is on would be nice too. I believe the add-in ReSharper can do this, but I'd prefer to use a free add-in rather than purchase one.
There is a RockScroll alternative called MetalScroll which is essentially the same thing with a few tweaks and improvements.
Also there is a small and simple WordLight plug-in that only highlights the identical tokens.
Both are open source and support code folding which is nice.
Imho, the bar next to the scroll bar in Eclipse is a lot more elegant solution than the scroll bar replacement of RockScroll/MetalScroll. Unfortunately I couldn't find any VS plug-ins that do it the Eclipse way, so I just stick with WordLight.
Check following addins
Productivity Power Tools- Displays error in scrollbar and
Highlight selected word
In a different question on SO (link), someone mentioned the VS 2005 / VS 2008 add-in "RockScroll". It seems to provide the "error bar" feature I was inquiring about in my question above.
RockScroll
EDIT: RockScroll also does the identical token highlighting that I was looking for! Great!
Old question but... Visual Studio 2010 has this feature built-in, at last.
The highlight functionality is conveniently implemented in VisualAssist.
In my opinion, they are both must-have.
1) Highlight identifier under editing caret:
Options -> Advanced -> Refactoring -> Automatically highlight references to symbol under cursor
2) Highlight search result - in all windows. Works for RegExps!
Options -> Advanced -> Display -> Highlight find results
About RockScroll: It doesn't highlight the identifiers. It only highlights the same string in the source code! If there are similar identifier declared : ex. _test and test, and test is highlighted it will highlight the string "test" in variable _test too! And it will also highlight the same string in a method called "sometesting()". So it isn't exactly like eclipse and doesn't work for me.
The automatic highlight is implemented in Visual Assist as the refactoring command "Find References". It highlights all occurences of a given variable or method, but that's not automatic (binded to a keyboard shortcut on my computer).
Here is an exmaple:
DevExpress CodeRush does this when you press TAB when the cursor is in an identifier, you can then tab through all the highlighted instances. There's also a DXCore plugin (the foundation upon which CodeRush/Refactor Pro are built) that does current-line highlighting.
In VS 2017, this can be solved by installing the Match Margin plugin.
It appears to be part of the Productivity Power Tools (which might be worth looking at for other features), but surprisingly, installing PPT didn't solve the problem for me, I had to install Match Margin separately.
The "error bar" functionality is provided in JetBrains ReSharper. I'm not sure if it does highlighting of references to the currently selected identifier.
For selected word(s) highlight function only, there is also StickyHighlight.
StickyHighlight supports Visual Studio 2010 & 2012.