且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 Android Studio lint 拼写检查器中排除文件

更新时间:2021-07-10 23:27:05

这可以通过使用 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.

  1. Settings/Appearance & 中添加新范围行为/范围 包含您要从拼写检查中排除的所有文件.例如,此模式涵盖所有 svg 文件:file:*.svg.在您的情况下,它可能类似于 file:*/colors.xml||file:*/cache.xml.IDE 将以绿色突出显示所有受影响的文件,以便您检查是否输入了正确的模式.

  1. 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.