Skip to content
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

Prototype autocompletion of tags and keyswords in YAML frontmatter #4519

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

UFOMelkor
Copy link
Contributor

Description

This PR provides autocompletion for tags and keywords in YAML frontmatter.

Changes

It enhances the current autocompletion for tags so that it also applies to YAML frontmatter.
Currently, this is a minimal prototype. It does not handle tags and keywords that are enclosed in quotes, and does also not handle single tags and keywords. Hence, this might be split into a separate autocompletion.

Additional information

Resolves #4070

Tested on: Ubuntu 22.04

@nathanlesage
Copy link
Member

I had imagined this much more hacky than what you did there 👀

Tbh I wanted to try to use Lezer's NodeProps to introduce autocomplete to YAML because it is (supposedly) more elegant and performant than manual checking, BUT for that we would need a CMv6 ready YAML parser, but nobody has done so so far :/

What is your opinion on this? Implement it like so so that we have autocomplete (we can duplicate the Tag autocomplete and adapt it only to YAML frontmatter, while making it use the same database, if you feel this will help) or wait until we can do it "the right way"?

@UFOMelkor
Copy link
Contributor Author

I fear, waiting until there is a CMv6 YAML parser would mean, writing one ourselves ;-)
(seriously, the issue was opened three years ago, and I guess there is no one for whom this is a first-level problem.)

Besides the initial developing, there are two things we should consider. Does it degrade the performance significantly, and how hard is it to maintain? From what I tried so far, the performance does not degrade. And the maintaining shouldn't be so hard either. The latter one might change, if there are countless edge cases to consider.

@nathanlesage
Copy link
Member

Yeah, true. And if we compartmentalise it into its own autocomplete the maintenance costs should always be manageable. Good point.

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.

autocomplete for keywords in YAML frontmatter
2 participants