Update and fix options in data/micro.json and runtime/help/options.md#3985
Update and fix options in data/micro.json and runtime/help/options.md#3985omarelladen wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
Looks good so far.
Unfortunately this will happen over and over again, since we maintain the options and their order at 4 different places:
- https://github.com/micro-editor/micro/blob/master/internal/config/settings.go
- https://github.com/micro-editor/micro/blob/master/data/micro.json
- https://github.com/micro-editor/micro/blob/master/runtime/help/options.md
- https://github.com/micro-editor/micro/blob/master/runtime/help/options.md#settingsjson-file
Somehow a self made problem, but a unnecessary one.
We should reduce the places or think about generating the stuff from one single point of truth.
|
Unfortunately we have now merge conflicts. |
|
@omarelladen: |
@JoeKar, I’m making a But I have a couple of questions before I do anything more.
"autosave": {
"description": "A delay between automatic saves\nhttps://github.com/zyedidia/micro/blob/master/runtime/help/options.md#options",
"type": "integer",
"minimum": 0, // 👀
"default": 0
},
// ...
"clipboard": {
"description": "A way to access the system clipboard\nhttps://github.com/zyedidia/micro/blob/master/runtime/help/options.md#options",
"type": "string",
"enum": [ // 👀
"external",
"terminal",
"internal"
],
"default": "external"
},
// ...
"indentchar": {
"description": "An indentation character\nhttps://github.com/zyedidia/micro/blob/master/runtime/help/options.md#options",
"type": "string",
"maxLength": 1, // 👀
"default": " "
},
// ...
"pluginrepos": {
"description": "Plugin repositories\nhttps://github.com/zyedidia/micro/blob/master/runtime/help/options.md#options",
"type": "array",
"uniqueItems": true, // 👀
"items": { // 👀
"description": "A pluging repository\nhttps://github.com/zyedidia/micro/blob/master/runtime/help/options.md#options",
"type": "string"
},
"default": []
},
// ...
"sucmd": {
"description": "A super user command\nhttps://github.com/zyedidia/micro/blob/master/runtime/help/options.md#options",
"type": "string",
"default": "sudo",
"examples": [ // 👀
"sudo",
"doas"
]
},
// ...
|
SchemaStore has some guidelines on authoring schemas that may be relevant (especially the "Avoiding Overconstraint" part): https://github.com/SchemaStore/schemastore/blob/master/CONTRIBUTING.md#schema-authoring |
|
I had in mind extracting most of the info from the source code, but I saw that the scheme (yesterday tried to enter that website and I couldn't) is different from what I was expecting. It will need to spread the data all over the place, and the single source of truth will be multiple sources, but in the same file. The easiest way I see is (mostly because of the scheme, markdown is more flexible) to embed and tag the data into the comments: // a list of settings that can be globally and locally modified and their
// default values
var defaultCommonSettings = map[string]any{
// @markdown
// when creating a new line, use the same indentation as the
// previous line.
// @scheme
// {
// "description": "Whether to use the same indentation as a previous line\nhttps://github.com/micro-editor/micro/blob/master/runtime/help/options.md#options",
// "type": "boolean",
// "default": true
// }
"autoindent": true,
// ...
var DefaultGlobalOnlySettings = map[string]any{
// @markdown
// automatically save the buffer every n seconds, where n is the
// value of the autosave option. Also, when quitting on a modified buffer,
// micro will automatically save and quit. Be warned, this option saves the buffer
// without prompting the user, so data may be overwritten. If this option is
// set to `0`, no autosaving is performed.
// @scheme
// {
// "description": "A delay between automatic saves\nhttps://github.com/micro-editor/micro/blob/master/runtime/help/options.md#options",
// "type": "integer",
// "minimum": 0,
// "default": 0
// },
"autosave": float64(0),I am not convinced, to be honest. |
No description provided.