Skip to content

Does commit 19872ee break the auto_depth option? #425

@svanharmelen

Description

@svanharmelen

It looks like commit 19872ee I have a helper function defined like this:

    local select_dir_for_live_grep = function(_)
      local action_state = require("telescope.actions.state")
      local current_line = action_state.get_current_line()
      local fb = require("telescope").extensions.file_browser
      local lg = require("telescope").extensions.live_grep_args

      fb.file_browser({
        files = false,
        hidden = false,
        attach_mappings = function(_)
          require("telescope.actions").select_default:replace(function()
            local entry_path = action_state.get_selected_entry().Path
            local dir = entry_path:is_dir() and entry_path or entry_path:parent()
            local relative = dir:make_relative(vim.fn.getcwd())

            lg.live_grep_args({
              cwd = dir:absolute(),
              default_text = current_line,
              results_title = relative .. "/",
            })
          end)

          return true
        end,
      })
    end

And the "normal" extension config looks like this:

      extensions = {
        file_browser = {
          attach_mappings = function(_, _)
            actions.open_qflist:replace(function()
              vim.cmd [[botright copen|cfirst]]
            end)
            return true
          end,
          auto_depth = true,
          display_stat = false,
          grouped = true,
          hidden = true,
          hide_parent_dir = true,
          mappings = {
            i = {
              ['<M-a>'] = fb_actions.create,
              ['<M-c>'] = fb_actions.copy,
              ['<M-d>'] = fb_actions.remove,
              ['<M-r>'] = fb_actions.rename,
            },
          },
          select_buffer = true,
        },

Previously this worked just fine, but now it only shows the toplevel folders when using the file browser during grep'ing. If I explicitly add the auto_depth = true option to the select_dir_for_live_grep method, nothing changes. But when I add the option depth = 1000 it suddenly works as expected again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions