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
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,12 +36,38 @@ The following settings are supported:
36
36
*`yaml.hover`: Enable/disable hover
37
37
*`yaml.completion`: Enable/disable autocompletion
38
38
*`yaml.schemas`: Helps you associate schemas with files in a glob pattern
39
-
*`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.
39
+
*`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).
40
40
*`[yaml]`: VSCode-YAML adds default configuration for all yaml files. More specifically it converts tabs to spaces to ensure valid yaml, sets the tab size, and allows live typing autocompletion. These settings can be modified via the corresponding settings inside the `[yaml]` section in the settings:
41
41
*`editor.insertSpaces`
42
42
*`editor.tabSize`
43
43
*`editor.quickSuggestions`
44
44
45
+
##### Adding custom tags
46
+
47
+
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, you can have the following custom tags:
48
+
49
+
```YAML
50
+
"yaml.customTags": [
51
+
"!Scalar-example scalar",
52
+
"!Seq-example sequence",
53
+
"!Mapping-example mapping"
54
+
]
55
+
```
56
+
57
+
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.
58
+
59
+
You can then use the newly defined custom tags inside the YAML file:
60
+
61
+
```YAML
62
+
some_key: !Scalar-example some_value
63
+
some_sequence: !Seq-example
64
+
- some_seq_key_1: some_seq_value_1
65
+
- some_seq_key_2: some_seq_value_2
66
+
some_mapping: !Mapping-example
67
+
some_mapping_key_1: some_mapping_value_1
68
+
some_mapping_key_2: some_mapping_value_2
69
+
```
70
+
45
71
##### Associating a schema to a glob pattern via yaml.schemas:
46
72
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 must be a relative path and not an absolute path.
0 commit comments