silverbulletmd / silverbullet

The hackable notebook
https://silverbullet.md
MIT License
2.06k stars 146 forks source link

Completion for attribute values #767

Open drawtheliner opened 4 months ago

drawtheliner commented 4 months ago

(Edit at the bottom!)

Is there a way (or is this in the plans) to suggest property names when adding them in the front matter, to avoid creating variations of the same thing (like tag and tags)?

Same for values. For example, if I have a property called "author", I'd like to get suggestions for existing values for this property across my space. That way I avoid having multiple entries that refer to the same thing - for example, Bob Gerald and Bob H. Gerald.

Edit: After further tests I realize there is indeed autocomplete for attribute names. There doesn't seem to be for the values however, unless I'm missing something?

zefhemel commented 4 months ago

Indeed there is nothing for values yet. I'm contemplating to add something akin to json schemas to allow people to enforce more structure on themselves, perhaps on values too. Not sure how to best do this yet. Also for attribute value completion I'm not sure how to determine for what attributes value completion would make sense, and for which wouldn't. I think it mostly would for enum-like attributes, but how would you know which are of that sort? Schemas could be an answer here.

drawtheliner commented 4 months ago

I think it would be enough to just let users create the attributes as usual, showing autocomplete to allow avoiding duplicate similar names. That way a schema naturally develops.

For values, I think autocomplete is useful for any non numeric attribute, as in the example in my original post.

Note I'm just suggesting a straightforward autocomplete, with no restrictions or validation.

I guess a next step could be to also have a way to limit input to a set of acceptable values, or even to impose validate (only emails accepted etc).

terr-steak commented 3 months ago

Indeed there is nothing for values yet. I'm contemplating to add something akin to json schemas to allow people to enforce more structure on themselves, perhaps on values too. Not sure how to best do this yet. Also for attribute value completion I'm not sure how to determine for what attributes value completion would make sense, and for which wouldn't. I think it mostly would for enum-like attributes, but how would you know which are of that sort? Schemas could be an answer here.

FWIW I am def in favor of having something like this in the application :)