ReSharper Abbreviations List: Where can I modify it? - resharper

I am using ReSharper 4.5, and what often happens when I am converting explicit properties into auto-properties, is that I will accidentally chose "Add XX to abbreviations list".
Ie: I want to convert CustomerID into an autoproperty, but due to quick butterfingers, I will accidentally add "ID" to the abbreviations list instead, which I don't want to do. (I want the naming rules to use "Id" instead of "ID").
Where can I find and modify the list of custom abbreviations in ReSharper 4.5??

In Resharper 5. see answer below.
-In Resharper 4 use Resharper/Options/Languages/Common/Naming Style
Choose the radio "Override common settings"
this enables the button "Manage Abbreviations"
For a specific language
Resharper/Options/Languages/C#/C# Naming Style
Resharper/Options/Languages/VB/VB Naming Style

In Resharper 7.x it's different than v6.0, its under the specific Language,
for me Resharper/Options/C#/C# Naming Style/Advanced settings
at the bottom of which are a list of space separated abbreviations.
Here's jetbrains (outdated?) site which details (I think the 6.x way of doing it?)
http://www.jetbrains.com/resharper/webhelp50/Coding_Assistance__Naming_Style.html#dynaProc3

In the 5.0 beta, it's similar
ReSharper/Options/Languages/Naming Style/Advanced Settings...
Then there's a box at the bottom called "Edit abbreviations as plain text"

In Resharper 6, it's almost the same as 5...
ReSharper/Options/Languages/Naming Style/Advanced Settings...
Then the box at the bottom is called "Abbreviations as plain text (UPPER CASE only):"

In Resharper 6.1 (beta) its slightly different to v6.0, its under
ReSharper/Options/Code Editing/C#/C# Naming Style/Advanced Settings
Then the box at the bottom is called "Abbreviations as plain text (UPPER CASE only):"

ReSharper 10.0.2 using Visual Studio 2015
ReSharper > Options > Code Editing > C# > Naming Style
Click Advanced settings to open the Advanced Naming Settings window.
Modify the text box Abbreviations

For ReSharper 2016 / 2017 this can be found under
ReSharper >> Options >> Code Editing >> C#/VisualBasic.net >> Naming Style >> Advanced Settings... >> Here you will find abbreviations
Depending on the language you will find it under different places..
Somtimes you will find it under
ReSharper >> Options >> Code Editing >> {language} >> Naming Style >> abbreviations
Screenshot:

ReSharper 9.2:
RESHARPER/Options/C#/Naming Style/Advanced settings

In resharper 5.X versions, please use "Reset to Defaults" to remove already added abbreviations.
ReSharper/Options/Code Editing/C#/C# Naming Style/Override to common settings/Reset to Defaults
#user1107632:
2D and 3D are not a valid variable and you are not going to use anyway.
http://www.informit.com/articles/article.aspx?p=24472

Related

Microsoft Visual Studio 2022 - Stop All and Any Formatting

I absolutely hate that Microsoft Visual Studio reformats my code. I'm constantly fighting with it. Over the years I've tried several versions and numerous settings but nothing stops the blighter. It insists on reformatting everything and as a general rule making a mess.
Automated re-indenting and alignment when applying brackets\braces or pasting in C#, Razor, HTML and JS files are my main pain points.
Seriously, it's a productivity issue and it drives me nuts 🥜. I know this question has been asked many, many times before, but surely, in this day and age there's a way to simply turn it ALL off?! Please tell me somewhere out there somebody knows how to do this.
Reference: Using Microsoft Visual Studio 2022 17.3.0. Community Edition. No plugins (Resharper etc.). All settings reset to defaults (using Tools > Import and Export Settings Wizard, Reset all Settings)
Side note: I know other IDEs exist but some projects just need MSVC and I'm not looking to change editors. Although I'd accept answers which recommend a plugin guaranteed to solve the problem.
This will not fully solve the issue but hopefully will already help so I'll post it as an answer.
Even without Resharper there are a lot of options under Text Editor settings and this allows you to control (to a certain extent) how the IDE formats your code, but sometimes it's option A or B and not "both" or "any". This means depending on what you type formatting will happen anyway, however as most people always format in a particular way, spending some time tweaking this is worth so once it is done it will be much less painful. Also the vast majority of settings is per specific language and not in the same structure, which does not make it easier. For C# - Braces for example, here's where to start:
Settings > C# > Code Style > Formatting > New Lines: all "Place open brace..." settings
Regarding the other main pain point (pasting) these should help:
HTML
Settings > Text Editor > HTML > Advanced: Set "Format on paste" to False.
JS
Settings > Text Editor > Javascript/Typescript > Formatting > General > Automatic Formatting: Uncheck "Format on paste"
C#
Settings > Text Editor > C# > Code Style > Formatting > General: Uncheck "Automatically format on... (all options to disable all)

XML attributes order in Android Studio

I'm facing problem with keeping proper order of XML attributes in Android Studio. As you can see below, the style attribute is between layout_* attributes, but I want it to be ordered by name (like in Eclipse). I'm using standard Intellij code formatter and the Android Studio gives users ability to set your own rules regarding XML ordering. The settings are located in Code Style -> XML -> Arrangement, but it seems not to work or I'm using it wrong. Any ideas how to order XML attributes by name using default code formatter?
<TestView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
style="#style/BackgroundLight"
android:layout_height="wrap_content">
</TestView>
Finally got it.
Choose File > Settings > Code Style > XML > Set from > Predefined Style > Android
Set File > Settings > Editor > Formatting > Show "Reformat Code" dialog
Run formatting on a XML file (CTRL+ALT+L by default)
You will see a popup window, set the Rearrange entries flag
Disable Reformat Code dialog in the settings
This way every XML file formatting will set the attributes in a proper order.
Edit:
Starting with Android Studio 0.2.6 release the XML Android style formatting is set by default, but you still have to set the Rearrange Entries flag manually.
http://tools.android.com/recent/androidstudio026released
Automatically apply the Android XML code style if a code style hasn't
already been customized. This will make it possible to automatically
order XML attributes (check the "Rearrange Entries" checkbox in the
"Code > Reformat Code..." dialog.)
UPDATE: the method I described below is an official way to fix this known issue, see: https://developer.android.com/studio/releases
After updating to the newest Android Studio v3.4.2 I found that it doesn't format XML code properly anymore. For instance, attributes ordering didn't work in layouts. It did indentation and namespaces ordering only.
I don't know the reason why it was broken after an update but was lucky to fix this:
Go to Settings (CMD + , ) on Mac.
Type format in Search box and click on Editor -> XML setting.
Click on the Android tab and make the same settings here as it's on a picture:
Settings on a picture quite normal, but of course you can tune this tab setting up to you.
Go to the Arrangement tab and you will see something like this:
The reason why attributes are not getting sorted - sorting rules are empty.
To fix this:
Choose Scheme and play with Default IDE and Project options. Switching between them may help.
Or choose Scheme which suites your needs and then click on Set from... blue text in right upper corner -> Predefined Style -> Android. You will see restored rules in the window:
I also chose Force rearrange - Always
To save result – click Apply.
Also you can click on a gear icon near Scheme and copy settings or even restore defaults.
P.S. To me standard rules are comfortable, but it can be customized further. Here is an article which may help doing this: https://medium.com/#VeraKern/formatting-xml-layout-files-for-android-47aec62722fc
Go to your layout XML
Try Ctrl + alt + shift + L then find checkbox label is Rearrange code and checked its.
To delete empty lines between them:
Preferences > Code Style > XML > Other > Keep blank lines: 0
And then just reformat your XML files.
There is a plugin for IntelliJ which might do what you're after...
http://plugins.jetbrains.com/plugin/?idea&pluginId=6546
File > Settings > Editor > XML > Arrangement Select Scheme and choose Default

resharper disable for c# .cs files

is it possible to only enable resharper for javascript and css files? I don't want it inspecting my c# files as it's driving me nuts with it's styling and and at times somewhat controversial recommendations. I haven't got time to set each individual setting, I'm just looking for a "don't inspect c# files" check box, if there isn't one I think my resharper trial will be officially over.
If you really want to disable ReSharper for C#, try going to ReSharper | Options -> Code Inspection | Settings -> Edit Items to Skip and add a file mask to skip *.cs.
But better way would be to disable those ReSharper warnings that you don't like. To do this, click Alt-Enter on the suggestion that you don't like, go to Options submenu, select Configure inspection severity and then Do not show. This is for ReSharper 8.0, in 7.1 it should be pretty similar.

Moving from coderush to resharper

I am about to make the switch to resharper from coderush after using it for 30 days and have some questions I would like to see if I can get some help on.
1: Can you change the resharper code colors? I tend to prefer dark themes so I would like to be able to migrate to a dark theme once the change is complete.
2: Do any other addin provide the member icon paint functionality of Coderush? It is the only feature that I do actually miss as it is handy for scanning. I don't mind paying for the functionality if it works.
EDIT: Found out how to change syntax colors.
There's no direct replacement of "paint member icons" in ReSharper.
I suggest that you use the File Structure window instead, with "Track caret in editor" and/or "Automatically scroll to source" options on to synchronize between focus in File Structure and the caret in the text editor.
As to other VS plug-ins, to my knowledge there aren't any prominent plug-ins that have that - neither VS10x CodeMap nor Productivity Power Tools provide anything similar.
1: Can you change the resharper code colors? I tend to prefer dark
themes so I would like to be able to migrate to a dark theme once the
change is complete.
As well as being able to change Resharper colours (In Tools->Options->Fonts and Colours, look for the "Resharper *" related options), R# supports Visual Studio light and dark themes:
http://www.jetbrains.com/resharper/webhelp/Managing_Color_Themes.html

Ctrl-W stopped working

I have Resharper installed and somehow CtrlW no longer "extends the selection". I tried assigning it to Global / Resharper.ExtendSelection in Tools -> Options -> Keyboard but it still only selects one word.
I have found the resolutions. Go to ReSharper -> Options -> Visual Studio Integration -> Keybord Shortcuts --> ReSharper or IntelliJ IDEA.Next time when you press CtrlW, Visual studio will ask you about shortcuts. You will choice ReSharper shortcuts and that is it.
A solution i found was to reconfigure keys at the Text Editor level (they are defined at Global level and for some (annoying) reason Resharper overrides this.
So: (Tools->Options->Environment->Keyboard), set Use new shortcut to Text Editor and redefine your shortcuts.
Tip: Look for your CtrlW favorites by writing view. at Show commands containing.
I needed View.ErrorList (CtrlW, CtrlE), View.Output (CtrlW, CtrlO) & View.SolutionExplorer (CtrlW, CtrlS)
HTH
p.s.
I even disabled Resharper and it still won't work...
A question and a suggestion:
Does Resharper | Edit | Extend Selection work?
Reapply VS integration via Resharper | Options | Visual Studio Integration | Apply Scheme
For me the reason was a silly one:
My C# file was removed from the project accidentally, so resharper no longer regarded it as C# code and so there were no syntactical elements to extend the selection to. In other files it worked ok.
In my case (Visual 2019)
go to Tools\Options\Environment\Keyboard
set Apply the following additional keyboard mapping scheme to Resharper (Visual Studio)
I had the silliest reason.
after the resharper installation I didn't apply my license or started the evaluation.

Resources