Intellij : Find usages , but exclude test files from results

前端 未结 4 1773
一整个雨季
一整个雨季 2021-01-30 10:06

Anyone knows how to exclude test files from find usages results ?

Like everything that is under : src/test/

相关标签:
4条回答
  • 2021-01-30 10:27

    You are able to create a custom search Scope

    A scope is a subset of files, packages and/or directories in your project, to which you can limit the application of specific operations, e.g. search, code inspection, insertion of copyright notices, etc.

    Edit -> Find -> Find Usages Settings...
    

    Use pattern

    !file:*Test.java or !file:*Test.java&&!file:*Tests.java or !test:*.*&&!test:*

    All your scopes you can find

    Android Studio -> Preferences -> Appearance & Behavior -> Scopes  
    

    Also you can customise a pattern by using syntax

    [Skip generated pattern]

    0 讨论(0)
  • Intellij Ultimate 11 version has an option to search in "Project production files".

    Just press Alt+F7 on a usage and look on Scope.

    0 讨论(0)
  • 2021-01-30 10:36

    In the Find usages result panel, you can group by test/production. There is a button for that.

    0 讨论(0)
  • 2021-01-30 10:40

    I found this answer extremely helpful:

    https://stackoverflow.com/a/45958976/5449497

    By putting !*Test.java into the File Mask textfield you can exclude Testfiles from your search results within the project.

    0 讨论(0)
提交回复
热议问题