7

In my GitHub README.md file, which is in the root of my Android project, I have code snippets like the following ones:

```xml
android:windowSoftInputMode="stateHidden"
```

```java
MongolToast.makeText(getApplicationContext(), "ᠰᠠᠢᠨ ᠪᠠᠢᠨ᠎ᠠ ᠤᠤ︖", MongolToast.LENGTH_LONG).show();
```

However, in Android Studio these code snippets give errors

enter image description here

I don't want to be warned of supposed code errors in the README file. How do I disable all errors here?

Notes:

  • I know how to suppress inspections normally in code with @SuppressLint or going into settings and unchecking the lint inspection. I don't want these errors to be suppressed in other areas of my project, though.
  • Somewhat similar question (without an answer): Android Studio - disable errors highlighting for excluded files
Vikasdeep Singh
  • 20,983
  • 15
  • 78
  • 104
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393

4 Answers4

5

After doing some further research I come to conclusion that these errors are not from Android Studio itself but there are plugins for markdown format like Markdown Navigator and Markdown Support if any of them is installed and enabled then you will see above errors in README.md file.

I think this spell check is built in feature of these plugins and can not be controlled from Android Studio.

One option what I think is to disable these plugins and you are good to go.

You can disable these plugins from (Android Studio 3.1.4 MacOS) Preferences > Plugins (or File > Settings > Plugins in Linux) by unchecking them and restart (don't forget it) your Android Studio:

enter image description here

Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
Vikasdeep Singh
  • 20,983
  • 15
  • 78
  • 104
2

First you need to create a scope (Settings->Scope) and add the files you want to keep out of scope for the Lints you wanna suppress.

Then go to Settings->Inspections, chose the inspection you wanna remove, and then on the right choose from the drop down your scope to define the wanted behavior.

scope_behavior

In this case, my scope is called AVOID_LINTS, and won't show any typo warnings.

EDIT

In the first step, when you create the scope, you need to add your README to the new scope.

EDIT2

Where to find the scopes: enter image description here

You may search for the files you want to add, select and click include.

Community
  • 1
  • 1
rusito23
  • 995
  • 8
  • 20
  • OP needs only for README file. Your answer will avoid lints for whole project. – Vikasdeep Singh Sep 06 '18 at 01:48
  • Maybe first paragraph wasn't clear. In your new scope you need to ADD the README.md. Then continue with the steps. Fixing the answer now. Tx! – rusito23 Sep 06 '18 at 02:02
  • did you test it? I am not able to find `Scope` in Android studio settings? Which version you are using? – Vikasdeep Singh Sep 06 '18 at 02:29
  • Yes and I use this config too. I use Android Studio 3.1.3 on macOS. Maybe using the search bar you will find it. (Settings->Appearance and Behavior->Scopes) – rusito23 Sep 06 '18 at 02:47
  • I tried exactly what you have mentioned but somehow it is not working for me in case of `README.md` file, either I am not doing it correctly or this solution works for non-markdown files (I maybe wrong). As per my understanding those errors are coming from Markdown plugin. Please check my answer. – Vikasdeep Singh Sep 06 '18 at 04:13
  • 1
    Think you are right, I don’t use md plugin really. Works for other files tho. – rusito23 Sep 06 '18 at 13:09
0

Remove code type annotation, change from:

```xml
android:windowSoftInputMode="stateHidden"
```

```java
MongolToast.makeText(getApplicationContext(), "ᠰᠠᠢᠨ ᠪᠠᠢᠨ᠎ᠠ ᠤᠤ︖", MongolToast.LENGTH_LONG).show();
```

change to:

```
android:windowSoftInputMode="stateHidden"
```

```
MongolToast.makeText(getApplicationContext(), "ᠰᠠᠢᠨ ᠪᠠᠢᠨ᠎ᠠ ᠤᠤ︖", MongolToast.LENGTH_LONG).show();
```
Petr Žoček
  • 151
  • 1
  • 4
0

Newer versions of Android Studio starting with 2022.2.1 Flamingo (at least from Beta 1) have an option to toggle "Show problems in code fences" under Preferences > Languages & Frameworks > Markdown.

Note that this toggles all problem types at the same time (typos, warnings and errors).

enter image description here

Ma3x
  • 5,761
  • 2
  • 17
  • 22