How to Change dictionary? - android-studio

I would like to resolve "Typo: in word..." that Android Studio (AS) show ever time I use words in my langage. I suppose there should be a way to add portuguese dictionary to AS but I could not find this option. Thanks for your help?

-You can add a suppress warning annotation over the words that are highlighted as having a typo like so:
#SuppressWarnings("SpellCheckingInspection")
private String exemplo;
-If you don't want to be adding that annotation in many places, you can deactivate the spellcheck:
Android Studio > Preferences > Editor > Inspections > Spelling and untick the typo option.
-If you want to add your own dictionary, you can go to Android Studio > Preferences > Editor > Spelling and click the cross sign to add a custom dictionary under Custom Dictionaries. You'll notice that there's already an English.dic in the bundled dictionaries. You need the Portuguese equivalent. Just search google for Portuguese dictionary .dic and you'll find a few.

Related

`Configure Logcat Formatting Options` has no effect

Android Studio 2021.3.1.17 > Configure Logcat Formatting Options > Modify Views > Uncheck Show repeated tags > Uncheck Show repeated package names > [OK].
Despite this, Repeated tags and and package names continue to be displayed, even after restarting IDE.
Even the simple option to display Time instead of Datetime does not work:
Any idea how to solve this?

Is there a way to enable interactive search in properties window?

I just started to use Android Studio and wondering if there is a way to search interactively in property window.
I mean like Xcode does. (It's not a properties, though.)
Is there a plugin or configuration for the function like this?
Android Studio actually has a search tool for properties similar to the one in Xcode. But it's implemented in a very unusual and un-intuitive way. Which makes it hard to find.
In Android Studio version 1.5.1, you have to click either on the 'Properties' header or any property-name below the header, and then you need to start typing the property you want, even though there is no text-box or any other indication that your typing will produce any effect.
When you do this, then a text-box appears with the characters you've typed in. And Android Studio highlights all the properties that contain your character sequence. You can then look only at the highlighted properties to find the one you want.
There is no filter like in Xcode, but if you start typing property name the selection will jump to the first match and the rest of the matches will be highlighted.

Exclude files from Android Studio lint spell checker

The Android Studio lint spell checker flags hex codes that look to it like words in certain files that would be better off unchecked, such as values/colors.xml and build/intermediates/dex-cache/cache.xml.
How do I tell lint to not spell check certain folders or files?
This can be done by using IDE scopes. In Android Studio (at least 3.4) you can configure each inspection per scope. The idea is that you create a scope that contains all files you don't want to be spellchecked, and then switch Spelling inspection off for this scope, but keep it on for everything else.
Add a new scope in Settings / Appearance & Behavior / Scopes that contains all files which you want to exclude from spell checking. For example, this pattern covers all svg files: file:*.svg. In your case it could be like file:*/colors.xml||file:*/cache.xml. IDE will highlight all affected files by green, so you can check if you entered correct pattern.
Then set up Spelling inspection, so that it is OFF for your new scope and ON everywhere else.
Had the same problem with colors.xml
I couldn't find a way to disable the check for a certain file, but I could get rid of the spellcheck on the hex codes.
Click Analyze->Inspect Code.
Choose Whole Project and click OK.
The inspection tool window will open with the results.
You should be able to see the problematic hex codes under Spelling->typo.
Right click any one of them and choose Exclude.
Did the trick for me. HTH

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 Abbreviations List: Where can I modify it?

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

Resources