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

Many things broken after the latest update #247

Closed
nyngwang opened this issue Dec 12, 2021 · 14 comments
Closed

Many things broken after the latest update #247

nyngwang opened this issue Dec 12, 2021 · 14 comments
Labels
bug Something isn't working

Comments

@nyngwang
Copy link
Contributor

nyngwang commented Dec 12, 2021

The command shortcuts I'm using:

vim.api.nvim_set_keymap('n', '<Leader>j', '<cmd>lua require("fzf-lua").builtin()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<Leader>r', '<cmd>lua require("fzf-lua").lsp_references()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<C-F>', '<cmd>lua require("fzf-lua").live_grep_resume()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<C-B>', '<cmd>lua require("fzf-lua").buffers()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<C-G>', '<cmd>lua require("fzf-lua").files_resume()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<Leader>gs', '<cmd>lua require("fzf-lua").git_status()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<Leader>gl', '<cmd>lua require("fzf-lua").git_commits()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<Leader>gp', '<cmd>lua require("fzf-lua").git_files()<CR>', NOREF_NOERR_TRUNC)

And the status for each of them(V means work, X means buggy):

V
X
V
X
X
X
V
X

The error by running <cmd>lua require("fzf-lua").buffers()<CR>:

E5108: Error executing lua ...k/packer/start/fzf-lua/lua/fzf-lua/providers/buffers.lua:190: ...ite/pack/packer/start/fzf-lua/lua/fzf-lua/make_entry.lua:106: attempt to index field 'file_icon_colors'
(a nil value)
stack traceback:
        [builtin#36]: at 0x010d5ccfd5
        ...k/packer/start/fzf-lua/lua/fzf-lua/providers/buffers.lua:190: in function 'buffers'
        [string ":lua"]:1: in main chunk

And for both files and files_resume there is no error message. But each looks like:

files:

files_resume:

For oldfiles the cursor is not focused:

And the error message when trigger oldfiles with dashboard.nvim:

Error detected while processing function <SNR>81_call_line_function:
line    6:
E5108: Error executing lua ...nvim/site/pack/packer/start/fzf-lua/lua/fzf-lua/core.lua:354: ...ite/pack/packer/start/fzf-lua/lua/fzf-lua/make_entry.lua:106: attempt to index field 'file_icon_colors'
(a nil value)
stack traceback:
        [builtin#36]: at 0x010d4a5fd5
        ...nvim/site/pack/packer/start/fzf-lua/lua/fzf-lua/core.lua:354: in function <...nvim/site/pack/packer/start/fzf-lua/lua/fzf-lua/core.lua:321>
        .../nvim/site/pack/packer/start/fzf-lua/lua/fzf-lua/cmd.lua:79: in function 'run_command'
        .../nvim/site/pack/packer/start/fzf-lua/lua/fzf-lua/cmd.lua:100: in function 'load_command'
        [string ":lua"]:1: in main chunk

If I press <ESC> to try to close the floating window of oldfiles (as it used to work) I got:

@ibhagwan
Copy link
Owner

Seems like all are related to the same issue, can you post your config so I can try it out?

make_entry.lua:106: attempt to index field 'file_icon_colors'

@nyngwang
Copy link
Contributor Author

nyngwang commented Dec 12, 2021

I comment out the commit = ... as a temporary fix. The adding of multiprocess = false, didn't work on my last try.

fzf-lua:

use {
  'ibhagwan/fzf-lua',
  requires = {
    -- WARNING: nvim-fzf is not fzf itself, install it using brew!
    'vijaymarupudi/nvim-fzf',
    'kyazdani42/nvim-web-devicons'
  },
  -- commit = 'fd4e94e',
  config = function()
    local actions = require "fzf-lua.actions"
    require'fzf-lua'.setup {
      winopts = {
        border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' },
        height = 0.8,
        width = 0.5,
        row = 0.9,
        col = 0.9,
        preview = {
          -- WARNING: Run `brew install bat` to install bat.
          default = 'bat',
          title = false,
          wrap = 'nowrap',
          vertical = 'down:80%',
          layout = 'vertical'
        }
      },
      files = {
        prompt = ' File $ ',
        multiprocess = false,
        -- WARNING: Run `brew install fd` to install bat.
        fd_opts =
          "--hidden "..
          "--ignore-case "..
          " "..
          "--type f "..
          "--max-depth 15 "..
          "--exclude .DS_Store "..
          "--exclude .git "..
          "--exclude node_modules "..
          "--exclude '*-lock.json' "..
          "--exclude '*.lock' "..
          " ",
        actions = {
          -- WARNING: This is required. Or files will be opened in quick-fix list.
          ["default"] = actions.file_edit,
        }
      },
      oldfiles = {
        multiprocess = false,
        actions = {
          -- WARNING: This is required. Or files will be opened in quick-fix list.
          ["default"] = actions.file_edit,
        },
      },
      grep = {
        multiprocess = false,
        prompt = ' Word $ ',
        -- WARNING:
          -- Run `brew install ripgrep` to install ripgrep.
          -- Restrict the range to search by <Enter> and <C-]>.
        actions = {
          -- WARNING: This is required. Or files will be opened in quick-fix list.
          ["default"] = actions.file_edit,
        },
        rg_opts =
          "--column "..
          "--line-number "..
          "--no-heading "..
          "--case-sensitive "..
          "--hidden "..
          " "..
          "--max-columns 200 "..
          "--max-filesize 1M "..
          "--max-depth 10 "..
          " "..
          "--glob '!.local/share' "..
          "--glob '!.config/nvim/plugin' "..
          "--glob '!.Trash' "..
          "--glob '!Library' "..
          "--glob '!Documents' "..
          "--glob '!Pictures' "..
          " "..
          "--glob '!.git' "..
          "--glob '!node_modules' "..
          "--glob '!package-lock.json' "..
          "--glob '!yarn.lock' "..
          "--glob '!tags' "..
          " ",
        color_icons = false,
      },
      git = {
        status = {
          multiprocess = false,
          actions = {
            -- WARNING: This is required. Or files will be opened in quick-fix list.
            ["default"] = actions.file_edit,
            ["ctrl-y"] = function(selected)
              for _, file in ipairs(selected) do
                -- do whatever you want with the file
                vim.fn.system('git add ' .. file)
              end
            end
          },
        }
      }
    }
  end
}
vim.api.nvim_set_keymap('n', '<Leader>j', '<cmd>lua require("fzf-lua").builtin()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<Leader>r', '<cmd>lua require("fzf-lua").lsp_references()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<C-F>', '<cmd>lua require("fzf-lua").live_grep_resume()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<C-B>', '<cmd>lua require("fzf-lua").buffers()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<C-G>', '<cmd>lua require("fzf-lua").files_resume()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<Leader>gs', '<cmd>lua require("fzf-lua").git_status()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<Leader>gl', '<cmd>lua require("fzf-lua").git_commits()<CR>', NOREF_NOERR_TRUNC)
vim.api.nvim_set_keymap('n', '<Leader>gp', '<cmd>lua require("fzf-lua").git_files()<CR>', NOREF_NOERR_TRUNC)

dashboard-nvim:

use {
  'glepnir/dashboard-nvim',
  config = function()
    vim.g.dashboard_custom_header = require'config.dashboard_data'.header
    vim.g.dashboard_custom_footer = require'config.dashboard_data'.footer
    vim.g.dashboard_custom_section = {
      a = { description = { "   Recents       " }, command = "FzfLua oldfiles" },
      b = { description = { "   Find Word     " }, command = "FzfLua live_grep" },
      c = { description = { "   Project Files " }, command = "FzfLua git_files" },
      -- e = { description = { "  Bookmarks       " }, command = "" },
    }
    -- This line will cause trouble in searching by `/`.
    -- vim.cmd('cnoreabbrev s Dashboard')
  end
}
vim.api.nvim_set_keymap('n', '<Leader>s', '<cmd>Dashboard<CR>', NOREF_NOERR_TRUNC)

@ibhagwan
Copy link
Owner

Found the issue, it's all in one place causing all of this mess, will have a fix soon.

@nyngwang
Copy link
Contributor Author

@ibhagwan Thank you!

@ibhagwan
Copy link
Owner

ibhagwan commented Dec 12, 2021

Can you try now?

I found one more minor issue related to git_icons, will have a fix for that too.

Edit: everything should be working now.

@nyngwang
Copy link
Contributor Author

nyngwang commented Dec 12, 2021

@ibhagwan Some problem remains on files_resume. (I tested it with all multiprocess = false, removed.)

No-problem-now list:

  • lsp_references
  • live_grep_resume
  • buffers
  • git_status, git_commits, git_files

@ibhagwan
Copy link
Owner

ibhagwan commented Dec 12, 2021

So is everything is working aside from files_resume?

I'm not sure I understand from the screenshot what seems to be the problem with files_resume? the layout?
Does it still have the problem with multiprocess = false?

@nyngwang
Copy link
Contributor Author

nyngwang commented Dec 12, 2021

So is everything working good aside from files_resume?

Yes!

I'm not sure I understand from the screenshot what seems to be the problem with files_resume? the layout?

If I type d and remove it, then it looks like this:

Does it still have the problem with multiprocess = false?

@ibhagwan Updated: No problem when I set multiprocess = false to option files = { ... }. So I think the multiprocess = false is working now.

@ibhagwan ibhagwan added the bug Something isn't working label Dec 12, 2021
@ibhagwan
Copy link
Owner

Does regular files (no resume) work properly with multiprocess = true?

I'd still like to have everything working with multiprocess both true and false, not sure why this would happen, files_resume only adds a few lines of code and ends up calling files so I'm confused...

This is the entire code for files_resume, if this fails I would assume regular files fails too:

M.files_resume = function(opts)

  opts = config.normalize_opts(opts, config.globals.files)
  if not opts then return end
  if opts._is_skim then
    utils.info("'files_resume' is not supported with 'sk'")
    return
  end

  local raw_act = shell.raw_action(function(args)
    last_query = args[1]
  end, "{q}")

  opts.fzf_opts['--query'] = vim.fn.shellescape(last_query)
  opts._fzf_cli_args = ('--bind=change:execute-silent:%s'):
    format(vim.fn.shellescape(raw_act))

  return M.files(opts)
end

@nyngwang
Copy link
Contributor Author

nyngwang commented Dec 12, 2021

Does regular files (no resume) work properly with multiprocess = true?

Both failed as the img shown.

So is everything working good aside from files_resume?

Sorry that I didn't test files the moment. For "all" I meant what listed in the No-problem-list.

@ibhagwan
Copy link
Owner

Both failed as the img shown.

Ok, it makes sense then, something isn't right with the external neovim command.

Would you mind helping me debug this? if you run :FzfLua files debug=true it will print the neovim command to the :messsages window, can you copy it from there and run it in a another terminal and let me know if it outputs the files properly in the terminal?

If it doesn't work, paste the command here and we can try and tweak it and see why it fails.

Btw, you don't need to add multiprocess = false to everthing, it only applies to files, grep and git.files.

@nyngwang
Copy link
Contributor Author

nyngwang commented Dec 12, 2021

if you run :FzfLua files debug=true it will print the neovim command to the :messsages window, ...

I got:

'nvim' -n --headless --clean --cmd 'lua loadfile([[/Users/ningwang/.local/share/nvim/site/pack/packer/start/fzf-lua/lua/fzf-lua/libuv.lua]])().spawn_stdio({debug=true,cmd=[[fd --hidden --ignore-case
 --type f --max-depth 15 --exclude .DS_Store --exclude .git --exclude node_modules --exclude '\''*-lock.json'\'' --exclude '\''*.lock'\''  ]],git_icons=false,file_icons=true,color_icons=true},[[_G._d
evicons_path='\''/Users/ningwang/.local/share/nvim/site/pack/packer/start/nvim-web-devicons/lua/nvim-web-devicons.lua'\''; _G._fzf_lua_server='\''/var/folders/lv/kwn3wy3j1ts64brr3ysrqjb80000gp/T/nvim
IAQI6E/1'\''; return require("make_entry").file]],[[return require("make_entry").preprocess]])'

...can you copy it from there and run it in a another terminal and let me know if it outputs the files properly in the terminal?

Yes! Many(40,000+) lines are printed out in the terminal and I think this is all the files (with those options regarded) inside my ~ directory. (I'm using Alacritty.)

Btw, you don't need to add multiprocess = false to everthing, it only applies to files, grep and git.files.

I add multiprocess = true to files. I won't touch the other things that are working correctly.

@ibhagwan
Copy link
Owner

That's exactly what should happen, the command processes the files, adds the icons and pipes it to fzf without fzf knowing this is actually neovim.

The fact this is working fine for you means that theoretically multiprocess = true should work well for you but then again it's not...

Due to the issues you experienced I reset the default to multiprocess = false and asked for testers in #248. Hopefully people will test it so we can get to the bottom of this and I can enable it as default again, the performance should be stellar with it.

@ibhagwan
Copy link
Owner

Closed the issue for now since the default is false, we can discuss this new setting in #248.

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

2 participants