frankroeder / parrot.nvim

parrot.nvim 🦜 - the plugin that brings stochastic parrots to Neovim. This is a gp.nvim-fork focused on simplicity.
Other
219 stars 14 forks source link

Refactor config merge #24

Closed eterps closed 2 months ago

eterps commented 2 months ago

Refactor config merge, work in progress. See also: https://github.com/frankroeder/parrot.nvim/discussions/22#discussioncomment-9957522

eterps commented 2 months ago

I discovered that M.agents as a data structure a bit different than the default agents list. The config_utils function index_agents_by_name fixes that.

@frankroeder at this point it at least works for me. I still have to investigate what needs to be cleaned up.

frankroeder commented 2 months ago

I am looking forward to merge this.

eterps commented 2 months ago

I am looking forward to merge this.

Did you look into the changes in detail? I am still unfamiliar with large parts of the code in parrot/init.lua. Could you give me some time to check some basic things? It won't take too long.

On the other hand, it will still be merged into a separate branch, nothing will break (yet).

eterps commented 2 months ago
  1. Removed provider/agent filters, as the new merge functions now handle most of this functionality.
  2. As a result, the current validity checks have been eliminated. We should reassess our approach to these checks.
  3. Implemented a new validity check to ensure that at least one provider is configured.
eterps commented 2 months ago

@frankroeder, I've removed some superfluous code.

The user config validation could still be improved, but I believe the code's readability has been enhanced overall.

Additionally, I think factoring out M._available_providers and M._available_provider_agents could further simplify the code.

Please let me know if you need any more changes. If not, feel free to merge this into your branch.