public static @NotNull @Unmodifiable List<LocalInspectionToolWrapper> filterToolsApplicableByLanguage(@NotNull Collection<? extends LocalInspectionToolWrapper> tools,
                                                                                                        @NotNull Set<String> elementDialectIdsForRegularTool,
                                                                                                        @NotNull Set<String> elementDialectIdsForWholeFileTool) {
    Map<String, Boolean> resultsWithDialects = new HashMap<>();
    Map<String, Boolean> resultsNoDialects = new HashMap<>();
    return ContainerUtil.filter(tools, tool -> {
      String toolLanguageId = tool.getLanguage();
      if (toolLanguageId == null || toolLanguageId.isBlank() || "any".equals(toolLanguageId)) return true;

      boolean applyToDialects = tool.applyToDialects();
      Map<String, Boolean> map = applyToDialects ? resultsWithDialects : resultsNoDialects;
      return map.computeIfAbsent(toolLanguageId, __ ->
        ToolLanguageUtil.isToolLanguageOneOf(tool.runForWholeFile() ? elementDialectIdsForWholeFileTool : elementDialectIdsForRegularTool, toolLanguageId, applyToDialects));
    });
  }
public static @NotNull @Unmodifiable List<LocalInspectionToolWrapper> filterToolsApplicableByLanguage(@NotNull Collection<? extends LocalInspectionToolWrapper> tools,
                                                                                                        @NotNull Set<String> elementDialectIdsForRegularTool,
                                                                                                        @NotNull Set<String> elementDialectIdsForWholeFileTool)