Support return types for yaml.customTags#1255
Merged
Merged
Conversation
Signed-off-by: Morgan Chang <shin19991207@gmail.com>
datho7561
approved these changes
May 19, 2026
Contributor
datho7561
left a comment
There was a problem hiding this comment.
Looks good, works well and seems really helpful. Thanks, Morgan!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds optional return types to the
yaml.customTagssetting.Previously, a custom tag could only describe the YAML node type the tag is written on. For example,
"!Seq-example sequence"tells the parser that!Seq-examplewould map to a sequence custom tag, but schema validation still treats the tagged value as a sequence.This PR adds a new form
"!Tag nodeType:returnType", wherenodeTypespecifies the YAML node type that the tag is written on, andreturnTypespecifies the schema type that the tagged value evaluates to.yaml.customTagsnow supports three forms:Existing configurations remain supported, so this is backward compatible. Behavior only changes when a user explicitly adds
:returnType.What issues does this PR fix or reference?
Fixes redhat-developer/vscode-yaml#867
Note that
yaml.customTagsonly applies to YAML short-form tags. It does not apply to CloudFormation long form such asFn::.... Long form values are normal YAML mappings, not YAML tags.Is it tested? How?
yaml.customTagsconfiguration in workspace setting (a list of all intrinsic functions in short form with return types added, based on the AWS CloudFormation intrinsic function docs):{ "yaml.customTags": [ "!Base64 scalar:string", "!Cidr sequence:array", "!And sequence:boolean", "!Equals sequence:boolean", "!If sequence", "!Not sequence:boolean", "!Or sequence:boolean", "!Condition scalar:boolean", "!FindInMap sequence:string", "!GetAtt scalar:string", "!GetAtt sequence:string", "!GetAZs scalar:array", "!ImportValue scalar:string", "!Join sequence:string", "!Select sequence:string", "!Split sequence:array", "!Sub scalar:string", "!Sub sequence:string", "!Transform mapping", "!Ref scalar:string" ] }template.yamlwith the following content: