从Android Studio棉绒拼写检查器中排除文件 [英] Exclude files from Android Studio lint spell checker
问题描述
Android Studio棉绒拼写检查器会标记看起来像某些文件中的单词的十六进制代码,最好不加检查,例如values/colors.xml
和build/intermediates/dex-cache/cache.xml
.
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?
推荐答案
这可以通过使用IDE范围来完成.在Android Studio(至少3.4)中,您可以按作用域配置每个检查.这样的想法是,您创建一个包含所有您不想进行拼写检查的文件的合并范围,然后为该合并范围关闭拼写检查",而对其他所有文件都保持打开状态.
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.
-
在
Settings / Appearance & Behavior / Scopes
中添加一个新范围,其中包含要从拼写检查中排除的所有文件.例如,此模式涵盖所有svg
文件:file:*.svg
.在您的情况下,可能类似于file:*/colors.xml||file:*/cache.xml
. IDE将以绿色突出显示所有受影响的文件,因此您可以检查是否输入了正确的模式.
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 allsvg
files:file:*.svg
. In your case it could be likefile:*/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.
这篇关于从Android Studio棉绒拼写检查器中排除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!