Open tummetott opened 8 months ago
This is related to a bug in our async lib. Basically - without going into too much detail - there is a wait operation being invoked here that is supposed to be blocking, but it isn't fully. This leads to LibUV's scheduler progressing onto other scheduled tasks, that then run into problems because the editor is still in a semi-locked state.
I have fixed this locally in a local branch where I'm refactoring the async lib. Unfortunately, that refactor isn't ready yet, and the fix needed here is not trivial. This issue also does not arise during normal usage of the plugin, and due to me having little time to work on the plugin lately, this will probably not be fixed any time soon. Sorry about that.
Thank you for providing clarification. I appreciate your assistance in helping me understand the nature of this bug. I'm doing the system call myself as workaround, which alleviates the issue for now. Given that, there's no immediate urgency to address this on your end. Feel free to close this issue if there are no plans to fix it. Thanks again
Feel free to close this issue if there are no plans to fix it.
It will be fixed. Like I said, I have already addressed this issue in local development branch. I just don't know when I'll have time to finish the refactor that includes the fix.
We can leave this issue open until the refactor comes around.
Hello Sindrets,
I currently have the following code snippet in my configuration to generate the text for my winbar, and it's working well. However, I believe this feature could be of interest to other users as well, and the existing code involves a lot of customization and boilerplate.
local view = require('diffview.lib').get_current_view()
local bufnr = vim.api.nvim_get_current_buf()
local rev_label = ''
local path = ''
for _, file in ipairs(view.cur_entry and view.cur_entry.layout:files() or {}) do
if file:is_valid() and file.bufnr == bufnr then
path = string.format('%s/%s', view.adapter.ctx.toplevel, file.path)
local rev = file.rev
if rev.type == 1 then
rev_label = 'LOCAL'
elseif rev.type == 2 then
local head = vim.trim(vim.fn.system(
{'git', 'rev-parse', '--revs-only', 'HEAD'}))
if head == rev.commit then
rev_label = 'HEAD'
else
rev_label = string.format('%s', rev.commit:sub(1, 7))
end
elseif rev.type == 3 then
rev_label = ({
[0] = 'INDEX',
[1] = 'MERGE COMMON ANCESTOR',
[2] = 'MERGE OURS',
[3] = 'MERGE THEIRS',
})[rev.stage] or ''
end
end
end
if rev_label == '' then
return path
else
return string.format('%s on %s', path, rev_label)
end
I'm wondering if it would be possible to provide an API function that allows users to access winbar information more easily. Here's a possible function signature:
require('diffview').get_winbar_info(win_id)
The function would return the following (or a similar) dictionary:
{
file_path = string, -- PATH
type = string, -- LOCAL|COMMIT|STAGE
commit_hash = string, -- HASH|nil
head = bool, -- true|false
stage_number = int, -- 0|1|2|3|nil
}
I'm aware of the winbar_info = true
option. However, this setting directly sets the winbar and doesn't allow for customization, such as using fancy NerdFont icons, etc.
Description
I have chosen to create a new issue based on #251. This decision stems from my efforts to pinpoint the problem and construct a minimal configuration that reliably reproduces the error.
I want to get the abbreviated revision object name for HEAD and show it in my
winbar
. The winbar is generated by feline.nvimThe following code errors if it is run inside a feline provider function:
Expected behavior
The abbreviated revision object name is shown in my winbar
Actual behavior
E565: Not allowed to change text or change window
Steps to reproduce
nvim --clean -u mini.lua
:cd <random git repo>
:DiffviewOpen
Health check
Output of
``` ============================================================================== diffview: require("diffview.health").check() Checking plugin dependencies ~ - WARNING Optional dependency 'nvim-web-devicons' not found. Checking VCS tools ~ - The plugin requires at least one of the supported VCS tools to be valid. - OK Git found. - OK Git is up-to-date. (2.39.2) - WARNING Configured `hg_cmd` is not executable: 'hg' ============================================================================== lazy: require("lazy.health").check() lazy.nvim ~ - OK Git installed - OK no existing packages found by other package managers - OK packer_compiled.lua not found ============================================================================== nvim: require("nvim.health").check() Configuration ~ - OK no issues found Runtime ~ - OK $VIMRUNTIME: /opt/homebrew/Cellar/neovim/0.9.4/share/nvim/runtime Performance ~ - OK Build type: Release Remote Plugins ~ - OK Up to date terminal ~ - key_backspace (kbs) terminfo entry: `key_backspace=\177` - key_dc (kdch1) terminfo entry: `key_dc=\E[3~` - $TERM_PROGRAM="tmux" - $COLORTERM="truecolor" tmux ~ - OK escape-time: 0 - OK focus-events: on - $TERM: tmux-256color - WARNING Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly. - ADVICE: - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux: set-option -sa terminal-features ',XXX:RGB' - For older tmux versions use this instead: set-option -ga terminal-overrides ',XXX:Tc' ============================================================================== provider: health#provider#check Clipboard (optional) ~ - OK Clipboard tool found: pbcopy Python 3 provider (optional) ~ - WARNING No Python executable found that can `import neovim`. Using the first available executable for diagnostics. - WARNING Could not load Python 3: /usr/bin/python3 does not have the "neovim" module. python3.12 not found in search path or not executable. python3.11 not found in search path or not executable. python3.10 not found in search path or not executable. python3.9 not found in search path or not executable. python3.8 not found in search path or not executable. python3.7 not found in search path or not executable. python not found in search path or not executable. - ADVICE: - See :help |provider-python| for more information. - You may disable this provider (and warning) by adding `let g:loaded_python3_provider = 0` to your init.vim - Executable: Not found Python virtualenv ~ - OK no $VIRTUAL_ENV Ruby provider (optional) ~ - Ruby: ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin22] - WARNING `neovim-ruby-host` not found. - ADVICE: - Run `gem install neovim` to ensure the neovim RubyGem is installed. - Run `gem environment` to ensure the gem bin directory is in $PATH. - If you are using rvm/rbenv/chruby, try "rehashing". - See :help |g:ruby_host_prog| for non-standard gem installations. - You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim Node.js provider (optional) ~ - Node.js: v20.8.1 - WARNING Missing "neovim" npm (or yarn, pnpm) package. - ADVICE: - Run in shell: npm install -g neovim - Run in shell (if you use yarn): yarn global add neovim - Run in shell (if you use pnpm): pnpm install -g neovim - You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim Perl provider (optional) ~ - WARNING "Neovim::Ext" cpan module is not installed - ADVICE: - See :help |provider-perl| for more information. - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim ============================================================================== vim.lsp: require("vim.lsp.health").check() - LSP log level : WARN - Log path: /Users/jonas/.local/state/bugreport/lsp.log - Log size: 0 KB vim.lsp: Active Clients ~ - No active clients ============================================================================== vim.treesitter: require("vim.treesitter.health").check() - Nvim runtime ABI version: 14 - OK Parser: c ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.4/lib/nvim/parser/c.so - OK Parser: lua ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.4/lib/nvim/parser/lua.so - OK Parser: query ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.4/lib/nvim/parser/query.so - OK Parser: vim ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.4/lib/nvim/parser/vim.so - OK Parser: vimdoc ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.4/lib/nvim/parser/vimdoc.so ```:checkhealth diffview
Log info
Relevant info from
``` [INFO 2023-10-26 13:22:48.037 +0200] .../share/bugreport/lazy/diffview.nvim/lua/diffview/lib.lua:24: [command call] :DiffviewOpen [ERROR 2023-10-26 13:23:09.670 +0200] ...lazy/diffview.nvim/lua/diffview/vcs/adapters/hg/init.lua:53: [HgAdapter] Configured `hg_cmd` is not executable: 'hg' ```:DiffviewLog
Neovim version
Operating system and version
Darwin 22.5.0 arm64
Minimal config