You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+29-1
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,35 @@ The following settings are supported:
33
33
*`yaml.hover`: Enable/disable hover
34
34
*`yaml.completion`: Enable/disable autocompletion
35
35
*`yaml.schemas`: Helps you associate schemas with files in a glob pattern
36
-
*`yaml.customTags`: Array of custom tags that the parser will validate against. It has two ways to be used. Either an item in the array is a custom tag such as "!Ref" or you can specify the type of the object !Ref should be by doing "!Ref Scalar". For example: ["!Ref", "!Some-Tag Scalar"]. The type of object can be one of Scalar, Sequence, Mapping, Map.
36
+
*`yaml.customTags`: Array of custom tags that the parser will validate against. It has two ways to be used. Either an item in the array is a custom tag such as "!Ref" and it will automatically map !Ref to scalar or you can specify the type of the object !Ref should be e.g. "!Ref sequence". The type of object can be either scalar (for strings and booleans), sequence (for arrays), map (for objects).
37
+
38
+
##### Adding custom tags
39
+
40
+
In order to use the custom tags in your YAML file you need to first specify the custom tags in the setting of your code editor. For example, we can have the following custom tags:
41
+
42
+
```YAML
43
+
"yaml.customTags": [
44
+
"!Scalar-example scalar",
45
+
"!Seq-example sequence",
46
+
"!Mapping-example mapping"
47
+
]
48
+
```
49
+
50
+
The !Scalar-example would map to a scalar custom tag, the !Seq-example would map to a sequence custom tag, the !Mapping-example would map to a mapping custom tag.
51
+
52
+
We can then use the newly defined custom tags inside our YAML file:
53
+
54
+
```YAML
55
+
some_key: !Scalar-example some_value
56
+
some_sequence: !Seq-example
57
+
- some_seq_key_1: some_seq_value_1
58
+
- some_seq_key_2: some_seq_value_2
59
+
some_mapping: !Mapping-example
60
+
some_mapping_key_1: some_mapping_value_1
61
+
some_mapping_key_2: some_mapping_value_2
62
+
```
63
+
64
+
37
65
##### Associating a schema to a glob pattern via yaml.schemas:
38
66
yaml.schemas applies a schema to a file. In other words, the schema (placed on the left) is applied to the glob pattern on the right. Your schema can be local or online. Your schema path must be relative to the project root and not an absolute path to the schema.
0 commit comments