nvimtools / hydra.nvim

Create custom submodes and menus
MIT License
129 stars 7 forks source link

Activating hint floating window crashes treesitter #42

Open rperryng opened 1 month ago

rperryng commented 1 month ago

Hey there, I was hoping to bring some attention to an existing issue in the original repo:

It seems that activating a hydra with config.hint.type = 'window' seems to break treesitter integration somehow.

Setting any other kind of config.hint.type window luckily avoids the problem.

I can't seem to find any related error logs (via :messages or :LspInfo / :LspLog). The behaviour I see is:

  1. open buffer (triggering LSP to start / attach to buffer)
  2. activate Hydra
  3. exit Hydra a. as I make edits, all my tree-sitter based plugins no longer seem to work (syntax highlighting on edited tokens breaks, and diagnostics etc don't pop up)
  4. Open a new file a. The opened file has no syntax highlighting b. :LspInfo shows the old language server still running, but does not attach to the new buffer

I apologize for the lack of details, happy to provide a minimal reproducible example if needed. I will also try to dig through the code when I have some more time to try and understand the root cause. Thanks.

-- lazy-lock.json
{
  ...,
  "hydra.nvim": { "branch": "master", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
  "nvim-treesitter": { "branch": "master", "commit": "d7353a6b72008b38aa873ace49aa97bea257941b" },
  "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
  "nvim-treesitter-textobjects": { "branch": "master", "commit": "48128953949b51235ccada535f021a505fdaf3df" },
}
# :version
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
benlubas commented 1 month ago

can you give the output of :echom &ft before the hydra is opened, and then again after things have broken?

rperryng commented 1 month ago

Yes sure thing, here's a screencap to demonstrate:

Screencap ![hydra](https://github.com/user-attachments/assets/5bf0810c-9006-4770-96a5-e4e95110dd7e)
  1. opening a lua file and running :echo &ft (prints lua)
  2. entering and exiting a hydra and running :echo &ft (still prints lua)
  3. scrolling down to reveal my blank-lines indent plugin (indent-blankline) no longer working
  4. opening another lua file and running echo &ft (which prints nothing, also no syntax highlighting) and :LspInfo/:LspLog
benlubas commented 1 month ago

Can you send the hydra you're using, I can't reproduce this with my windows hydra, or my options hydra, both of which create floating hints.

rperryng commented 1 month ago

Yep, definitely. Actually, I was able to reproduce the syntax highlighting issue without having any other plugins installed... here's the entire config:

❯ tree ~/.config/nvim-hydra7
/Users/rperryng/.config/nvim-hydra7
├── init.lua
└── lazy-lock.json
files ```lua -- init.lua -- Install lazy local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' if not vim.uv.fs_stat(lazypath) then vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--single-branch', 'https://github.com/folke/lazy.nvim.git', lazypath, }) end vim.opt.runtimepath:prepend(lazypath) -- Setup plugins require('lazy').setup({ { 'nvimtools/hydra.nvim', config = function() local hydra = require('hydra') hydra({ name = 'Quickfix navigation', config = { invoke_on_body = true, hint = { type = 'window', }, }, mode = 'n', body = 'HQ', heads = { { 'n', function() vim.cmd('silent! cnext') end, }, { 'p', function() vim.cmd('silent! cprevious') end, }, }, }) end, }, }) ``` ```lua -- lazy-lock.json { "hydra.nvim": { "branch": "main", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" }, "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" } } ```
screencap ![hydra9](https://github.com/user-attachments/assets/b6f1f457-efc4-4219-b01f-bb12c7993081)
benlubas commented 4 weeks ago

I'm unable to reproduce with the latest commit from main, is there anything keeping you from updating the plugin?

https://github.com/user-attachments/assets/de102b46-19dc-4004-a0c6-a13e0d6a1ba3

rperryng commented 4 weeks ago

Aghh sorry, I didn't realize I was on an older version... i assumed that when I changed from using the original repo to the fork that lazy would pull the latest version but I guess as long as the commit sha in my lazy-lock.json was still valid that it wouldn't try to update it... really sorry about that.

It does seem the latest version works fine for the minimal example I gave but I still see the issues with my main configuration with all other plugins, I'll see if I can produce another minimal example with the latest version of nvimtools/hydra.nvim.