aniseed
aniseed copied to clipboard
Improve error reporting
Fennel provides fennel.traceback, which can provide more ergonomic, readable and pleasing error messages. This is already being used in aniseed.eval, where the errors will be printed nicely. When using aniseed for the vim configuration however, errors don't run through traceback, thus showing rather ugly and unhelpful lua error messages.
Wrapping the configuration in an xpcall that defers errors to fennels traceback handler should be pretty simple to implement, and would already drastically improve the experience of configuring vim in fennel.
This would still not affect any deferred execution, and thus wouldn't affect anything that's called on keybinds, autocmds, or passed as callbacks to other functions. This could be improved in several ways:
- Simply provide an easy-to-use function to wrap custom functions in, that wraps the function you're calling in xpcall for you. This would require actively doing it, and would make it an "always-on" thing, which is both suboptimal. BUT: it would be rather trivial.
- Try to automatically wrap functions by possibly using the fennel compiler plugin API (?). This would work automatically and allow the user to toggle it on and off depending on "development" vs "in-use" state. It would however also bring more extreme performance issues, and probably also change behaviour of code in many places where code relies on how errors behave.
- Try to intercept errors at a higher level, overriding the traceback handler that vim uses to print it's errors. lua has
debug.traceback
, but from what I can tell that's not what is being used here (although I can't be sure, haven't looked into it). At least from my primitive tests, just overriding that function changed nothing.
Just commenting to highlight for passers by that we've previously talked a little about this on Discord and I totally agree. Will be looking into this soon I hope! (lots to do, picking and choosing my battles carefully!)
I'm running into this problem where on one of my machines my fennel config completely fails on startup with an unhelpful error message:
But on the other it works fine. Unfortunately I have no idea what is causing this and I don't really even know how to approach figuring out what is going on. Do you have any tips for how to get better error messages in the meantime? Its preventing me from using aniseed which has been amazing in the past...
🤔 I don't think I have enough information to go on here, I can't really make any guesses. First of all, are you on a stable release or develop
? Since develop
is fragile at the moment as I make sweeping changes.
You could also try removing ~/.config/nvim/lua
entirely and have nvim rebuild it just in case something is hanging on that shouldn't be there or isn't recompiling?
First off, it was late when I posted that, so I want to reiterate that this is almost certainly an issue on my config or with the fact that I'm using windows. My question was more about how I might get some more useful debug information out of the system. Seems like neovim just eats the relevant information when getting errors from lua.
I'm motivated to get my system working because I think the project is really promising :) Aniseed is great
I have tried with both develop and master branches. And I have rebuilt the lua from scratch by deleting the lua folder and having nvim rebuild, with no luck... Is there a way to force aniseed to use the above aniseed.traceback on a temporary basis?
For some extra context, I reverted my config changes to the previous stable state and I still have issues. So I'm thinking there is something sticking around. I tried removing my nvim-data folder so that it is built from scratch with no luck. Is it possible that there is some other scripts/files sticking around somewhere that aniseed loads other than what is stored in the .config (actually appdata/local/nvim on windows) folder or the nvim-data folder?
Ok I've figured out some more details. The issue seems to be windows specific and is unrelated to this issue. Sorry to hijack. I will create a new issue