Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack overflow in Telescope #36

Closed
lmburns opened this issue Apr 22, 2022 · 2 comments
Closed

Stack overflow in Telescope #36

lmburns opened this issue Apr 22, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@lmburns
Copy link

lmburns commented Apr 22, 2022

Bug

After the commit cc1a3440, the ._close function has been deprecated. Now it just calls .close.

I use legendary.nvim, and when I close the telescope prompt, I get a stack overflow.

E5108: Error executing lua ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:55: stack overflow
stack traceback:
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:55: in function '_close'
        ...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:363: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function '_close'
        ...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:363: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function '_close'
        ...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'close'
        ...
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:363: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function '_close'
        ...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'close'
        ...packer/opt/telescope.nvim/lua/telescope/actions/init.lua:363: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function '_close'
        ...cker/opt/dressing.nvim/lua/dressing/select/telescope.lua:59: in function 'run_replace_or_original'
        ...k/packer/opt/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
        ...ack/packer/opt/telescope.nvim/lua/telescope/mappings.lua:242: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

I've noticed that the cause of the problem are the following lines in dressing.nvim:

actions.close:replace(function()
  actions._close(prompt_bufnr, false)
  on_choice(nil, nil)
end)

When the lines are deleted, everything still seems to work just fine. I'm not sure if they are needed, or need to be changed.

Neovim

NVIM v0.7.0-dev+1443-gdbd5242d8
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az32-353

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

Dressing Configuration

Config
  require("dressing").setup {
    input = {
      -- Set to false to disable the vim.ui.input implementation
      enabled = true,

      -- Default prompt string
      default_prompt = "",

      -- When true, <Esc> will close the modal
      insert_only = true,

      -- These are passed to nvim_open_win
      anchor = "SW",
      border = "rounded",
      -- 'editor' and 'win' will default to being centered
      relative = "cursor",

      -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
      prefer_width = 40,
      width = nil,
      -- min_width and max_width can be a list of mixed types.
      -- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total"
      max_width = { 140, 0.9 },
      min_width = { 20, 0.2 },

      -- Window transparency (0-100)
      winblend = 10,
      -- Change default highlight groups (see :help winhl)
      winhighlight = "",

      override = function(conf)
        -- This is the config that will be passed to nvim_open_win.
        -- Change values here to customize the layout
        return conf
      end,

      -- see :help dressing_get_config
      get_config = nil,
    },
    select = {
      -- Set to false to disable the vim.ui.select implementation
      enabled = true,

      -- Priority list of preferred vim.select implementations
      backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" },

      -- Options for telescope selector
      -- These are passed into the telescope picker directly. Can be used like:
      -- telescope = require('telescope.themes').get_ivy({}),
      telescope = require('telescope.themes').get_dropdown({}),
      -- telescope = require("telescope.themes").get_cursor({}),

      -- Options for fzf selector
      fzf = { window = { width = 0.5, height = 0.4 } },

      -- Options for fzf_lua selector
      fzf_lua = { winopts = { width = 0.5, height = 0.4 } },

      -- Options for nui Menu
      nui = {
        position = "50%",
        size = nil,
        relative = "editor",
        border = { style = "rounded" },
        max_width = 80,
        max_height = 40,
      },

      -- Options for built-in selector
      builtin = {
        -- These are passed to nvim_open_win
        anchor = "NW",
        border = "rounded",
        -- 'editor' and 'win' will default to being centered
        relative = "editor",

        -- Window transparency (0-100)
        winblend = 10,
        -- Change default highlight groups (see :help winhl)
        winhighlight = "",

        -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
        -- the min_ and max_ options can be a list of mixed types.
        -- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total"
        width = nil,
        max_width = { 140, 0.8 },
        min_width = { 40, 0.2 },
        height = nil,
        max_height = 0.9,
        min_height = { 10, 0.2 },

        override = function(conf)
          -- This is the config that will be passed to nvim_open_win.
          -- Change values here to customize the layout
          return conf
        end,
      },

      -- Used to override format_item. See :help dressing-format
      format_item_override = {},

      -- see :help dressing_get_config
      get_config = nil,
    },
  }
@lmburns lmburns added the bug Something isn't working label Apr 22, 2022
@ten3roberts
Copy link

I am also getting this error.

vim.ui.select({"foo", "bar"}, {}, function(v) print(v) end)

The following sample creates said error upon selecting an entry or pressing escape

@stevearc
Copy link
Owner

Should be fixed now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants