onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.35k stars 301 forks source link

Expand config metadata settings with default values. #2094

Open CrossR opened 6 years ago

CrossR commented 6 years ago

We've spoken about this in a bunch of places I feel, but I couldn't find an exact issue to do with it.... Now we metadata associated with the config options, I think the last big piece of that puzzle is the addition of some way of specifying the valid values for that option.

Currently, we just silently fail in the background with default values, so if you make the very easy mistake of settings your tab mode to tab rather than tabs you default to buffers! Which for when there is only a few options, seems a pretty bad user experience. If instead an error was raised of "tab isn't valid" that is a lot better, and if there is autocomplete, even better again.

VSCode does something similar (or I assume they do), which allows the config experience to be a lot nicer and include auto complete and equivalent.

I see a few big blockers for this though:

bryphe commented 6 years ago

Thanks for logging the issue, @CrossR ! Agree, this is the next step we need.

Not much of the config is currently using this new metadata API. We'd need to refactor most of the config options to do so. I'm not against doing some of it, I find it fairly relaxing sometimes to just write bits up and what not!

That would be awesome! Maybe we can do this incrementally - there are a lot of places we'd need to add. But the good thing is the new API also lets us figure out if we can 'hot load' a config setting or not, so we can have a better experience around letting users knowt o reload, too.

Surface the appropriate metadata to the user, like the description and stuff.

I actually have a prototype for this, for the very few config settings we have at the moment.

Solving the UI problem for when an input has no set list of values. Ie for oni.loadInitVim we can surface true/false, but we also need to surface some way of saying "Hey you can also pass a path here".

Ya, I wonder if something like:

// Description: Determines whether a user's init.vim is loaded.
// This can be a `string` path, or a `boolean` (`true` or `false`). If set to `true`, it will load `init.vim` fro the default location.
// Values: true | false | string
"oni.loadInitVim": false,

Is good enough?