tris203 / hawtkeys.nvim

⌨️🔥 Suggest new easy to hit keymaps and find issues with your current key map configurations
MIT License
219 stars 4 forks source link

plenary "no such file or directory" error if broken symlinks present #77

Closed dnebauer closed 10 months ago

dnebauer commented 10 months ago

On my first attempted use of this plugin I tried the HawtkeysAll command and got the following error:

E5108: Error executing lua ....local/share/nvim/lazy/plenary.nvim/lua/plenary/path.lua:743: ENOENT: no such file or directory: /home/USER/.config/nvim/lua/config/test_file.lua
stack traceback:
    [C]: in function 'assert'
    ....local/share/nvim/lazy/plenary.nvim/lua/plenary/path.lua:743: in function 'read'
    ....local/share/nvim/lazy/hawtkeys.nvim/lua/hawtkeys/ts.lua:141: in function 'find_maps_in_file'
    ....local/share/nvim/lazy/hawtkeys.nvim/lua/hawtkeys/ts.lua:473: in function 'show_all'
    ....local/share/nvim/lazy/hawtkeys.nvim/lua/hawtkeys/ui.lua:264: in function 'show_all'
    [string ":lua"]:1: in main chunk

The file path given in the error message was a broken symlink. The broken symlink was some cruft and I took the opportunity to remove it, after which the plugin command worked fine.

If you're happy for the plugin command to fail on a broken symlink please feel free to close this issue -- I can't think of a situation where a user would want to keep broken symlinks, and they might appreciate your plugin bringing these broken links to their attention.

Alternatively, you might want the plugin to handle this situation more gracefully, perhaps silently ignoring broken symlinks.

tris203 commented 10 months ago

Hi @dnebauer thank you for letting me know

I wonder if this could be handled in #70 as part of the work @willothy is doing

willothy commented 10 months ago

Yeah that definitely falls under the scope of that issue. We do pretty much no path validation right now, which could definitely lead to a lot of issues. I will make sure to use libuv to check to symlinks and such in the PR for that. Should hopefully have a draft up at least later today.