redhat-developer / redhat-developer/vscode-yaml

Allow setting `yaml.customTags` as prefixes, so any suffix like `!u!28` is accepted without errors

Open
#1,156 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
830
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

Is your enhancement related to a problem? Please describe.

Same problem as this, but the proposed solution is terrible:

  • #755

Errors in Unity's asset files are impossible to disable without either:

Describe the solution you would like

Please allow a way for yaml.customTags to set the tag as a prefix. For example, you can simply allow a <*> at the end so that all tags with the prefix are matched. If you want to go even further, you could even allow any JS regex within <...> for a simple but flexible implementation. For example:

"yaml.customTags": [
    "tag:unity3d.com,2011:<*> mapping", // allow any suffix, e.g. `tag:unity3d.com,2011:28`
    "<tag:unity3d[.]com,2011:\\d+> mapping", // allow any custom regex
]
Describe alternatives you have considered

I've tried setting an empty json schema https://www.schemastore.org/any.json, but it doesn't suppress the "Unresolved tag" errors.

I've tried disabling validation to stop the errors, but it seems it can only be done globally, not per file extension/glob, see:

  • #998
Additional context

I don't know if I'm supposed to use some other workaround here, like referencing custom tags from an external URL somehow, or using some Unity YAML schema, but I didn't find anything of the sort.

I chose "enhancement", but I might as well call it a bug, since I get errors with no workaround, and tag suffixes are a part of YAML spec as far as I understand. You shouldn't force people to have to add every possible suffix, as the list can be giant and change with time, as in Unity's case.

If there's already a way to do this currently, then it's not properly documented.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start by locating the handling of the yaml.customTags setting and unresolved-tag validation, then determine how prefix or regex entries should be represented. Done means a prefix such as tag:unity3d.com,2011:<*> accepts suffixes like 28 without errors, with coverage for the requested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode, yaml
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.