code: def preferred_height(self, cli, width, max_available_height, wrap_lines):
          
          complete_state = cli.current_buffer.complete_state
          column_width = self._get_column_width(complete_state)
          column_count = max(1, (width - self._required_margin) // column_width)
  
          return int(math.ceil(len(complete_state.current_completions) / float(column_count)))
docs: Preferred height: as much as needed in order to display all the completions.