Skip to content

UI: autocomplete-for-tags #2273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

thseiler
Copy link
Contributor

This PR generalises the autocomplete feature to work for "Tag" fields (#2230)

The autocomplete options are collected from the contents of all the same fields of the current document.
I wonder whether we should also allow specifying optional default values in the grammar:

  - TITLE: TAGS
    TYPE: Tag
    REQUIRED: False 

  - TITLE: TAGS_WITH_DEFAULTS
    TYPE: Tag(Derived, Safety-relevant, Security-relevant)
    REQUIRED: False 

It could help with consistency. Let me know what you think...

@thseiler thseiler force-pushed the feature/2230-autocomplete-for-tags branch from e965c5a to b53ec66 Compare May 26, 2025 07:28
@stanislaw
Copy link
Collaborator

stanislaw commented May 26, 2025

Hi @thseiler, I will be reviewing this during the day.

Just a note regarding the TAGs: it looks like their handling is similar to that of MultipleChoice. To be honest, the tags feature was never developed to something that makes it a standalone feature. Could you describe how do you see the Tags work differently compared to MultipleChoice? Is there an opportunity for removing Tags altogether and moving forward with just MultipleChoice? I am curious to hear about your perspective. Understanding this would give an idea of whether the Tags are actually a mechanism of its own scope and value. Thanks.

@thseiler
Copy link
Contributor Author

I would like to better understand how others use the "Tag" type as well.

The main difference for me is whether the users are allowed to add (invent) new values on the fly:

  • MultipleChoice: No, the allowed values are constrained by the Grammar. Autocomplete collects possible values from Grammar.
  • Tags: Yes, the users can add new values while editing. Autocomplete collects possible values from other nodes in the Document.

I can see a use case for both, i.e. :

  • Multiple Choice: useful for STATUS or similar fields which are rigidly tied to some higher-up process.
  • Tags: mainly useful for me as author. I can leave "spontaneous little bits of information" for myself, i.e. hints at things that still need fixing, like "todo_safety", or "todo_testcase" there. I don't want to change the grammar for this.

One could potentially merge the two behaviours into just "MultipleChoice" by adding a property on whether the choices are to be constrained. If the property is if omitted, then the field would be contained by default to keep compatibility to MultipleChoice() as it is today.

Even then it could make sense to keep "Tag" alive as something separate to allow distinct visual styling. For example, the "Tag" type could imply a pill/chip visualisation of the values (in the future).

@stanislaw stanislaw merged commit 579a5a0 into strictdoc-project:main May 26, 2025
23 checks passed
@stanislaw stanislaw mentioned this pull request May 26, 2025
40 tasks
@stanislaw
Copy link
Collaborator

Your answer about MultipleChoice vs Tag makes sense. Let's maintain it like that. I have added a note to the documentation train to explain this like you suggested: #2067.

I would like to better understand how others use the "Tag" type as well.

I created tags with a similar idea like you explained, but we never pushed it to be displayed with UI in any nice way. I could imagine that the search query and UI would be extended to support filtering by tags, and the project statistics would show the Tag-breakdown for each document. Doing Document-level stats breakdown on Project Statistics is a related work item which does not have a ticket yet.

StrictDoc's own documentation does not use any tags, but I saw tags used very heavily in one project where multiple teams (electrical, SW, RAMS, etc.) worked on one big spec, and the tags were used to highlight specific areas of attention. This was very useful.

@mplum and @pasrom contributed PRs related to Tags. Maybe they could share their thoughts here.

The autocomplete options are collected from the contents of all the same fields of the current document.
I wonder whether we should also allow specifying optional default values in the grammar:

  - TITLE: TAGS_WITH_DEFAULTS
    TYPE: Tag(Derived, Safety-relevant, Security-relevant)
    REQUIRED: False 

I don't consider this a major need given the other priorities but if you feel it would simplify your workflows, please suggest a PR.

Thanks again for contributing this.

@thseiler thseiler deleted the feature/2230-autocomplete-for-tags branch May 27, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants