ibhagwan / fzf-lua

Improved fzf.vim written in lua
MIT License
2.31k stars 150 forks source link

Bug: LSP document_symbols doesn't take `winopts` #1113

Closed wimstefan closed 7 months ago

wimstefan commented 7 months ago

RTFM Checklist

Operating system

Linux

Shell

zsh

Neovim version (nvim --version)

NVIM v0.10.0-dev-2787+g6cfca21ba

Fzf version (fzf --version)

0.48.1 (d579e33)

Output of :lua print(os.getenv('FZF_DEFAULT_OPTS'))

-m --cycle --layout reverse --info=inline-right --no-separator --height ~90% --padding 1 --margin 1 --preview "fzf-preview.sh {}" --preview-window right:70%:hidden:wrap --bind "?:toggle-preview" --color "bg+:-1,fg+:-1,hl:36,hl+:36,info:75"

Is the problem reproducible with mini.sh?

Fzf-lua configuration

config = function()
      local fzf_lua = require('fzf-lua')

      local bottom_row = {
        height = 0.4,
        width = 1,
        row = 1,
        col = 0,
        preview = {
          layout = 'horizontal',
          horizontal = 'right:55%',
        }
      }
      local right_popup = {
        height = 0.97,
        width = 0.2,
        row = 0.3,
        col = 1
      }
      local right_column = {
        height = 1,
        width = 0.45,
        row = 0,
        col = 1,
        preview = {
          layout = 'vertical',
          vertical = 'down:65%'
        }
      }

      fzf_lua.setup({
        global_resume = true,
        winopts = bottom_row,
        builtin = {
          winopts = right_column
        },
        colorschemes = {
          winopts = right_popup
        },
        diagnostics = {
          winopts = right_column
        },
        files = {
          prompt = 'Files❯ ',
        },
        filetypes = {
          winopts = {
            relative = 'cursor',
            width = 0.14,
            row = 1.01
          }
        },
        git = {
          branches = {
            winopts = right_column
          },
          bcommits = {
            winopts = right_column
          },
          commits = {
            winopts = right_column
          },
          status = {
            winopts = right_column
          },
        },
        grep = {
          cmd = 'ugrep -RIjnkzs --hidden --ignore-files --exclude-dir=".git"',
          winopts = right_column
        },
        highlights = {
          winopts = right_column
        },
        lsp = {
          document_symbols = {
            winopts = right_column
          }
        },
        spell_suggest = {
          winopts = {
            relative = 'cursor',
            width = 0.2,
            row = 1.01
          }
        }
      })

      fzf_lua.register_ui_select(function(_, items)
        local min_h, max_h = 0.15, 0.70
        local h = (#items + 4) / vim.o.lines
        if h < min_h then
          h = min_h
        elseif h > max_h then
          h = max_h
        end
        return { winopts = { height = h, width = 0.60, row = 0.40 } }
      end)

    end

Describe the bug / steps to reproduce

I have configured lsp_document_symbols to have a specific winopts but it is not recognized when invoked ...

ibhagwan commented 7 months ago

Both document and workspace symbols inherit settings from lsp.symbols, change your setup to:


        lsp = {
          symbols = {
            winopts = right_column
          }
        },

If you wish to have this only apply to document symbols use winopts in the mapped command directly, i.e:

require'fzf-lua'.lsp_document_symbols({ winopts = … })
wimstefan commented 7 months ago

Works like a treat :) Thank you so much - also for this amazing plugin !!!

ibhagwan commented 7 months ago

Works like a treat :) Thank you so much - also for this amazing plugin !!!

Ty for the kind words and the update :heart: