Olical / aniseed

Neovim configuration and plugins in Fennel (Lisp compiled to Lua)
https://discord.gg/wXAMr8F
The Unlicense
606 stars 28 forks source link

Improve error reporting #40

Open elkowar opened 3 years ago

elkowar commented 3 years ago

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:

Olical commented 3 years ago

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!)

Kethku commented 3 years ago

I'm running into this problem where on one of my machines my fennel config completely fails on startup with an unhelpful error message: image

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...

Olical commented 3 years ago

🤔 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?

Kethku commented 3 years ago

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?

Kethku commented 3 years ago

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?

Kethku commented 3 years ago

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