| I really don't recommend using tryEval in this way... It was very situational in nixvim, and even then still probably wasn't the best solution. As you've pointed out, it has plenty of downsides.
I would recommend trying to find the option by recursively walking the "option attr path" (aka loc), checking each attr for lib.isOption and if true, continuing with opt.type.getSubOptions opt.loc.
getOptionRecursive was the part of the file I was hoping you would take inspiration from 😅
Once you have the actual (sub)option you can make use of opt.isDefined with no hacks needed.
|