Replies: 8 comments 5 replies
-
Here's an example of the extension to the structure of the { // I suggest we treat this as JSON5 not strict JSON
"plugin.id": "jgclark.DailyJournal",
// rest of existing file ...
"plugin.settingsVersion": 1,
"plugin.settings": [ // assumes the order of what follows is to be kept for the UI
{
"type": "heading", // i.e. not a setting but a heading to show. Might be possible to have this as type "info", but I'm separating this out for flexibility in the UI construction.
"markdownText": "## Settings for Journalling"
},
{
"type": "string",
"name": "reviewSectionHeading",
"text": "Heading to insert before review comments, if not already present",
"default": "Journal",
"required": true,
},
{
"type": "[string]",
"name": "moods",
"text": "Array of moods to choose between",
"default": ["🤩 Great","🙂 Good","😇 Blessed","🥱 Tired","😫 Stressed","😤 Frustrated","😔 Low","🥵 Sick","Other"],
"required": true,
},
{
"type": "info",
"markdownText": "A section of _markdown_ text, including [external links](https://github.com)."
},
{
"type": "string",
"name": "reviewQuestions",
"text": "",
"default": "@sleep(<number>)\\n@work(<number>)\\nMood:: <mood>\\nExercise:: <string>\\nGratitude:: <string>\\nGod was:: <string>\\nAlive:: <string>\\nNot Great:: <string>\\nWife:: <string>\\nRemember:: <string>",
"required": true,
},
{
"type": "separator", // implies a horizontal separator line goes here
},
{
"name": "sortMethod",
"type": "string",
"text": "How should the output be sorted?",
"singleSelectList": ["alpha", "date", "length"],
"default": "alpha",
"required": false,
},
],
} |
Beta Was this translation helpful? Give feedback.
-
My suggestion, implied from the requirements, is that the specification of settings (example above) live in the extended {
"plugin.settingsVersion": 1,
"plugin.settings": {
"reviewSectionHeading": "Journal",
"moods": ["🤩 Great","🙂 Good","😇 Blessed","🥱 Tired","😫 Stressed","😤 Frustrated","😔 Low","🥵 Sick","Other"],
"reviewQuestions": "@sleep(<number>)\\n@work(<number>)\\nMood:: <mood>\\nExercise:: <string>\\nGratitude:: <string>\\nGod was:: <string>\\nAlive:: <string>\\nNot Great:: <string>\\nWife:: <string>\\nRemember:: <string>",
},
} |
Beta Was this translation helpful? Give feedback.
-
@jgclark This is a terrific start!!! I have a couple questions / comments. I welcome your feedback and we can surely adjust (especially base on item 3) Note: The "plugin.settings" key is the ONLY item(s) which are displayed in the event a "name" item is removed in the future, thus only plugin defined settings items are displayed.
settings could be versioned using a simple one-up numbering system. If so, when a plugin is updated this number will be checked, and if it is greater than the current value, then the settings UI will be shown to the user.
Example w/ heading [there can only be ONE heading, it will always be at the top]
Example w/ info [remainder of static text rows will be
Example w/ select
Example w/ multiple
Example w/ checkbox
Example w/ radio
Example w/ text
|
Beta Was this translation helpful? Give feedback.
-
Further, I am curious as to what the timeline would be on implementing these new settings. As I am working on |
Beta Was this translation helpful? Give feedback.
-
Elsewhere @weyert suggested checking out VSCode's configuration schema. Sorry I didn't think of that earlier. It took a while but I tracked it down to https://code.visualstudio.com/api/references/contribution-points#contributes.configuration. {
"gitMagic.views.pageItemLimit": {
"type": "number",
"default": 20,
"markdownDescription": "Specifies the number of items to show in each page when paginating a view list. Use 0 to specify no limit"
}
}
Here's their slightly different approach to my
|
Beta Was this translation helpful? Give feedback.
-
Yes VSCode made the same transition nicely!
…On Fri, Oct 1 2021 at 3:21 PM, Jonathan Clark ***@***.***> wrote:
Elsewhere @weyert <https://github.com/weyert> suggested checking out
VSCode's configuration schema. Sorry I didn't think of that earlier. It
took a while but I tracked it down to
https://code.visualstudio.com/api/references/contribution-points#contributes.configuration
.
Unsurprisingly it is more extensive -- more than we need, I think -- but
pretty similar. This is an example for how you specify number, string or
boolean:
{
"gitMagic.views.pageItemLimit": {
"type": "number",
"default": 20,
"markdownDescription": "Specifies the number of items to show in each page when paginating a view list. Use 0 to specify no limit"
}
}
Entries of type number, string, boolean can be edited directly in the
settings UI. ... For boolean entries, the description (or
markdownDescription) will be used as the label for the checkbox.
Some object and array type settings will be rendered in the settings UI.
Simple arrays of number and string will be rendered as editable lists.
Objects that have properties of type string and/or boolean will be rendered
as editable grids of keys and values. The object type setting must set
"additionalProperties": false to get this support.
If an object or array type setting can also contain other types like
nested objects, arrays, or null, then the value won't be rendered in the
settings UI and can only be modified by editing the JSON directly.
Here's their slightly different approach to my choicesSelection idea
above:
enum: If you provide an array of items under the enum property, the
settings UI will render a dropdown menu. You can also provide an
enumDescriptions property, which provides descriptive text rendered at
the bottom of the dropdown.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#93 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACEI6VEEAHZVQANMYUOASIDUEYX65ANCNFSM5FC74YXA>
.
|
Beta Was this translation helpful? Give feedback.
-
I've spent a lot of time with Shopify and its Liquid templating. It's
fantastic, but not the right model for what we're doing here. VSCode feels
like the right approach.
…On Fri, Oct 01, 2021 at 6:53 PM, Mike Erickson ***@***.***> wrote:
Agreed, hence the reason I suggested. @weyert <https://github.com/weyert>
also suggested reviewing Shopify, but have not had time to review.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#93 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACEI6VDSYTPPDYWJNZS7SWTUEZQYJANCNFSM5FC74YXA>
.
|
Beta Was this translation helpful? Give feedback.
-
Thanks for sharing this list. The example JSON helps a lot! I’ll finish some features for the next release and then get to work. The new features are mostly iterations on what’s already there, so I’m hoping this won’t take so long. The next beta is also almost ready. Looks like plugin-wise this is the next high-priority improvement for me from your description. |
Beta Was this translation helpful? Give feedback.
-
We've had a conversations in several Discord channels and briefly by video conference about this; I thought it would help to start a discussion here to bring it into one place that's easier to reference. cc @EduardMe @mikeerickson @weyert @nmn @dwertheimer but of course open to anyone else too.
Why do we need a V2?
V1 was never designed; it just grew out of @nmn spotting a way to do config without any specific support from the NP app itself. We're now spending support time fixing fragility of this single, shared, _configuration resource, and that JSON is too complex for most users to handle.
Requirements for V2 (using will/should/could prioritisation)
plugin.json
fileDataStore.preference
andDataStore.setPreference()
APIs. To avoid name collisions, the setting name will be further distinguished by its specifiedplugin.id
plugin.json
fileBeta Was this translation helpful? Give feedback.
All reactions