rktjmp/hotpot.nvim

Ways to deal with infinite loops

Closed this issue · 2 comments

Any ideas are there ways to implement this?
So neovim would not hang on infinite loops for :Fnl commands or reflect api? Some function to bind to abort it or at least configured timeout?

Not really. :lua has the same issue, or when you're writing a plugin and it gets stuck. AFAIK there is no reliable way to break out of that in nvim.

It's not really practical to write a infinite recursion/loop detector without some static analysis tool before running the code. Once it's going there isn't a way to stop it via any API, so no timer can fire to stop it or counter be incremented to track.

Perhaps the eval could be run on a separate thread which could be killed, maybe. That might not take nvim down with it but it's not something I have the time to explore at the moment.

Ok got it.