GithubHelp home page GithubHelp logo

Comments (1)

fan-tom avatar fan-tom commented on June 12, 2024

The issue is that com.github.fantom.codeowners.search.CodeownersSearchScopeDescriptor#getScope is called from com.intellij.structuralsearch.plugin.ui.ScopePanel#SCOPE_FILTER, to filter out some scopes. It doesn't affect Class Hierarchy scope the same way it affects mine, because this scope is filtered out by name:

  private static final Condition<ScopeDescriptor> SCOPE_FILTER =
    (ScopeDescriptor descriptor) -> IdeBundle.message("scope.class.hierarchy").equals(descriptor.getDisplayName()) ||
                                    !(descriptor.getScope() instanceof ModuleWithDependenciesScope); // don't show module scope

It is not triggered when using "Find in Files" because it uses a different flow, where similar filter doesn't invoke getScope:

// com.intellij.find.impl.FindPopupScopeUIImpl#initComponents

    myScopeCombo.init(myProject, true, true, selection, new Condition<>() {
      //final String projectFilesScopeName = PsiBundle.message("psi.search.scope.project");
      final String moduleFilesScopeName;

      {
        String moduleScopeName = IndexingBundle.message("search.scope.module", "");
        final int ind = moduleScopeName.indexOf(' ');
        moduleFilesScopeName = moduleScopeName.substring(0, ind + 1);
      }

      @Override
      public boolean value(ScopeDescriptor descriptor) {
        final String display = descriptor.getDisplayName();
        return /*!projectFilesScopeName.equals(display) &&*/ !display.startsWith(moduleFilesScopeName);
      }
    });

As we can see, ModuleWithDependenciesScope is filtered out using just name, without scope instantiation.

There are other extension points other than com.intellij.scopeDescriptorProvider to implement scopes: com.intellij.searchScopesProvider and com.intellij.customScopesProvider, but neither of them is designed for scopes, that require showing custom UI to define the scope, and the only builtin scope with such UI is carefully handled in the code (hardcoded)

from intellij-codeowners.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.