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

:Gitsigns setloclist does not populate loclist, but calling gitsigns.setloclist() works #880

Closed
bew opened this issue Sep 18, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@bew
Copy link

bew commented Sep 18, 2023

Description

TSIA?

Neovim version

NVIM 0.9.2

Operating system and version

NixOS, Linux 6.0.0.

Expected behavior

:Gitsigns setloclist
The loclist window should opened and be filled with entries for each hunks

Actual behavior

Gitsigns setloclist
Observe that the loclist window is opened but is empty (zero entries)

Minimal config

(not changed compared to provided mini config)

for name, url in pairs{
  gitsigns = 'https://github.com/lewis6991/gitsigns.nvim',
} do
  local install_path = vim.fn.fnamemodify('gitsigns_issue/'..name, ':p')
  if vim.fn.isdirectory(install_path) == 0 then
    vim.fn.system { 'git', 'clone', '--depth=1', url, install_path }
  end
  vim.opt.runtimepath:append(install_path)
end

require('gitsigns').setup{
  debug_mode = true, -- You must add this to enable debug messages
}

Steps to reproduce

  1. nvim --clean -u minimal.lua <path/to/file/with/changes>
  2. :Gitsigns setloclist 👉 observe the loclist window is opened but is empty (zero entries)
  3. Close the window with :lclose
  4. :lua require"gitsigns".setloclist() 👉 observe that the loclist window is opened and has entries for each hunks

Gitsigns debug messages

debug messages
signs.init: Using vimfn signs
dprintf: Deriving GitSignsAdd from DiffAdd
dprintf: Deriving GitSignsChange from DiffChange
dprintf: Deriving GitSignsDelete from DiffDelete
dprintf: Deriving GitSignsChangedelete from GitSignsChange
dprintf: Deriving GitSignsTopdelete from GitSignsDelete
dprintf: Deriving GitSignsUntracked from GitSignsAdd
dprintf: Deriving GitSignsAddNr from GitSignsAdd
dprintf: Deriving GitSignsChangeNr from GitSignsChange
dprintf: Deriving GitSignsDeleteNr from GitSignsDelete
dprintf: Deriving GitSignsChangedeleteNr from GitSignsChangeNr
dprintf: Deriving GitSignsTopdeleteNr from GitSignsDeleteNr
dprintf: Deriving GitSignsUntrackedNr from GitSignsAddNr
dprintf: Deriving GitSignsAddLn from DiffAdd
dprintf: Deriving GitSignsChangeLn from DiffChange
dprintf: Deriving GitSignsChangedeleteLn from GitSignsChangeLn
dprintf: Deriving GitSignsUntrackedLn from GitSignsAddLn
dprintf: Deriving GitSignsStagedAdd from GitSignsAdd
dprintf: Deriving GitSignsStagedChange from GitSignsChange
dprintf: Deriving GitSignsStagedDelete from GitSignsDelete
dprintf: Deriving GitSignsStagedChangedelete from GitSignsChangedelete
dprintf: Deriving GitSignsStagedTopdelete from GitSignsTopdelete
dprintf: Deriving GitSignsStagedAddNr from GitSignsAddNr
dprintf: Deriving GitSignsStagedChangeNr from GitSignsChangeNr
dprintf: Deriving GitSignsStagedDeleteNr from GitSignsDeleteNr
dprintf: Deriving GitSignsStagedChangedeleteNr from GitSignsChangedeleteNr
dprintf: Deriving GitSignsStagedTopdeleteNr from GitSignsTopdeleteNr
dprintf: Deriving GitSignsStagedAddLn from GitSignsAddLn
dprintf: Deriving GitSignsStagedChangeLn from GitSignsChangeLn
dprintf: Could not derive GitSignsStagedDeleteLn
dprintf: Deriving GitSignsStagedChangedeleteLn from GitSignsChangedeleteLn
dprintf: Could not derive GitSignsStagedTopdeleteLn
dprintf: Deriving GitSignsAddPreview from DiffAdd
dprintf: Deriving GitSignsDeletePreview from DiffDelete
dprintf: Deriving GitSignsCurrentLineBlame from NonText
dprintf: Deriving GitSignsAddInline from TermCursor
dprintf: Deriving GitSignsDeleteInline from TermCursor
dprintf: Deriving GitSignsChangeInline from TermCursor
dprintf: Deriving GitSignsAddLnInline from GitSignsAddInline
dprintf: Deriving GitSignsChangeLnInline from GitSignsChangeInline
dprintf: Deriving GitSignsDeleteLnInline from GitSignsDeleteInline
dprintf: Deriving GitSignsDeleteVirtLn from DiffDelete
dprintf: Deriving GitSignsDeleteVirtLnInLine from GitSignsDeleteLnInline
dprintf: Deriving GitSignsVirtLnum from GitSignsDeleteVirtLn
attach(1): Attaching (trigger=setup)
run_job: git --version
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 config user.name
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 rev-parse --show-toplevel --absolute-git-dir --abbrev-ref HEAD
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/bew/projects/dotfiles/.git -c core.quotepath=off ls-files --stage --others --exclude-standard --eol
/home/bew/projects/dotfiles/flake.nix
watch_gitdir(1): Watching git dir
run_job: git --no-pager --literal-pathspecs -c gc.auto=0 --git-dir /home/bew/projects/dotfiles/.git show :0:flake.nix
update(1): updates: 1, jobs: 5
cli.run: Running action 'setloclist' with arguments {}
attach(2): Attaching (trigger=BufReadPost)
attach(2): Non-normal buffer
attach(2): Attaching (trigger=BufReadPost)
attach(2): Non-normal buffer
attach(2): Attaching (trigger=BufReadPost)
attach(2): Non-normal buffer
attach(2): Attaching (trigger=BufReadPost)
attach(2): Non-normal buffer
cli.run: Running action 'debug_messages' with arguments {}
@bew bew added the bug Something isn't working label Sep 18, 2023
lewis6991 added a commit that referenced this issue Sep 22, 2023
@bew
Copy link
Author

bew commented Sep 22, 2023

Works great thank you!

What was the issue?
At that time I tried to look at the code to make a PR, but I didn't find anything.. And your final fix for this isn't very clear to me 🤔

@lewis6991
Copy link
Owner

Needed to add a binding function for the CLI version of the function.

There's some automatic adapting of cli args to function args but it doesn't work for everything.

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
2 participants