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

Activating hint floating window crashes treesitter #42

Open
rperryng opened this issue Aug 11, 2024 · 6 comments
Open

Activating hint floating window crashes treesitter #42

rperryng opened this issue Aug 11, 2024 · 6 comments

Comments

@rperryng
Copy link

rperryng commented Aug 11, 2024

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
Copy link
Collaborator

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

@rperryng
Copy link
Author

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

Screencap

hydra

  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
Copy link
Collaborator

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
Copy link
Author

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
-- 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 = '<space>HQ',
        heads = {
          {
            'n',
            function()
              vim.cmd('silent! cnext')
            end,
          },
          {
            'p',
            function()
              vim.cmd('silent! cprevious')
            end,
          },
        },
      })
    end,
  },
})
-- lazy-lock.json
{
  "hydra.nvim": { "branch": "main", "commit": "3ced42c0b6a6c85583ff0f221635a7f4c1ab0dd0" },
  "lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" }
}
screencap

hydra9

@benlubas
Copy link
Collaborator

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

screen_cap.mp4

@rperryng
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants